Completed
Branch master (55c02b)
by Nur
17s
created
src/Concerns/HasCustomUserStamps.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $columns = $this->getUserstampColumns();
123 123
 
124
-        if (! isset($columns[$columnName])) {
124
+        if ( !isset($columns[$columnName]) ) {
125 125
             throw new \InvalidArgumentException("Userstamp column '{$columnName}' is not configured.");
126 126
         }
127 127
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $hidden = [];
189 189
 
190 190
         foreach ($columns as $columnType => $columnConfig) {
191
-            if (($columnConfig['hidden'] ?? false) === true) {
191
+            if ( ($columnConfig['hidden'] ?? false) === true ) {
192 192
                 $columnName = $columnConfig['name'] ?? $columnType;
193 193
                 $hidden[] = $columnName;
194 194
             }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $casts = [];
207 207
 
208 208
         foreach ($columns as $columnType => $columnConfig) {
209
-            if (isset($columnConfig['cast'])) {
209
+            if ( isset($columnConfig['cast']) ) {
210 210
                 $columnName = $columnConfig['name'] ?? $columnType;
211 211
                 $casts[$columnName] = $columnConfig['cast'];
212 212
             }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $rules = [];
225 225
 
226 226
         foreach ($columns as $columnType => $columnConfig) {
227
-            if (isset($columnConfig['validation'])) {
227
+            if ( isset($columnConfig['validation']) ) {
228 228
                 $columnName = $columnConfig['name'] ?? $columnType;
229 229
                 $rules[$columnName] = $columnConfig['validation'];
230 230
             }
Please login to merge, or discard this patch.
src/Config/UserStampsConfigValidator.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
         $config = Config::get('userstamps', []);
40 40
 
41 41
         // Check if we have the new enhanced configuration structure
42
-        if (isset($config['columns']) && is_array($config['columns'])) {
42
+        if ( isset($config['columns']) && is_array($config['columns']) ) {
43 43
             // New enhanced configuration - validate required fields
44 44
             $requiredFields = ['users_table', 'users_table_column_type', 'users_table_column_id_name', 'users_model'];
45 45
 
46 46
             foreach ($requiredFields as $field) {
47
-                if (! isset($config[$field])) {
47
+                if ( !isset($config[$field]) ) {
48 48
                     $errors[] = "Missing required configuration: {$field}";
49 49
                 }
50 50
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             ];
62 62
 
63 63
             foreach ($rules as $key => $rule) {
64
-                if (! isset($config[$key])) {
64
+                if ( !isset($config[$key]) ) {
65 65
                     $errors[] = "Missing required configuration: {$key}";
66 66
 
67 67
                     continue;
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
 
70 70
                 $validator = Validator::make([$key => $config[$key]], [$key => $rule]);
71 71
 
72
-                if ($validator->fails()) {
72
+                if ( $validator->fails() ) {
73 73
                     $errors[] = "Invalid configuration for {$key}: ".$validator->errors()->first($key);
74 74
                 }
75 75
             }
76 76
         }
77 77
 
78 78
         // Always validate users_table_column_type if present (regardless of structure)
79
-        if (isset($config['users_table_column_type'])) {
79
+        if ( isset($config['users_table_column_type']) ) {
80 80
             $validTypes = ['increments', 'bigIncrements', 'uuid', 'ulid', 'bigInteger', 'integer', 'string', 'text', 'char'];
81
-            if (! in_array($config['users_table_column_type'], $validTypes)) {
81
+            if ( !in_array($config['users_table_column_type'], $validTypes) ) {
82 82
                 $errors[] = "Invalid configuration for users_table_column_type: {$config['users_table_column_type']}";
83 83
             }
84 84
         }
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
         $columns = Config::get('userstamps.columns', []);
96 96
 
97 97
         // If no columns configuration is set, use defaults
98
-        if (empty($columns)) {
98
+        if ( empty($columns) ) {
99 99
             return $errors;
100 100
         }
101 101
 
102 102
         $requiredColumns = ['created_by', 'updated_by', 'deleted_by'];
103 103
 
104 104
         foreach ($requiredColumns as $columnType) {
105
-            if (! isset($columns[$columnType])) {
105
+            if ( !isset($columns[$columnType]) ) {
106 106
                 // Column not configured, skip validation
107 107
                 continue;
108 108
             }
@@ -123,31 +123,31 @@  discard block
 block discarded – undo
123 123
         $errors = [];
124 124
 
125 125
         // Validate name field if present
126
-        if (isset($config['name'])) {
126
+        if ( isset($config['name']) ) {
127 127
             $name = $config['name'];
128 128
 
129
-            if (! is_string($name) || empty($name)) {
129
+            if ( !is_string($name) || empty($name) ) {
130 130
                 $errors[] = "Column name for {$columnType} must be a non-empty string";
131 131
             } else {
132 132
                 // Get max length from advanced config or use default
133 133
                 $maxLength = Config::get('userstamps.advanced.column_name_validation.max_length', 64);
134
-                if (strlen($name) > $maxLength) {
134
+                if ( strlen($name) > $maxLength ) {
135 135
                     $errors[] = "Column name for {$columnType} exceeds maximum length of {$maxLength} characters";
136 136
                 }
137 137
 
138 138
                 // Get pattern from advanced config or use default
139 139
                 $pattern = Config::get('userstamps.advanced.column_name_validation.pattern', '/^[a-zA-Z_][a-zA-Z0-9_]*$/');
140
-                if (! preg_match($pattern, $name)) {
140
+                if ( !preg_match($pattern, $name) ) {
141 141
                     $errors[] = "Column name for {$columnType} contains invalid characters";
142 142
                 }
143 143
             }
144 144
         }
145 145
 
146 146
         // Validate type field if present
147
-        if (isset($config['type'])) {
147
+        if ( isset($config['type']) ) {
148 148
             $validTypes = ['increments', 'bigIncrements', 'uuid', 'ulid', 'bigInteger', 'integer', 'string', 'text', 'char'];
149 149
 
150
-            if (! in_array($config['type'], $validTypes)) {
150
+            if ( !in_array($config['type'], $validTypes) ) {
151 151
                 $errors[] = "Invalid column type for {$columnType}: {$config['type']}. Valid types are: ".implode(', ', $validTypes);
152 152
             }
153 153
         }
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
         // Validate boolean fields
156 156
         $booleanFields = ['nullable', 'index', 'foreign_key'];
157 157
         foreach ($booleanFields as $field) {
158
-            if (isset($config[$field]) && ! is_bool($config[$field])) {
158
+            if ( isset($config[$field]) && !is_bool($config[$field]) ) {
159 159
                 $errors[] = "Field '{$field}' for {$columnType} must be a boolean";
160 160
             }
161 161
         }
162 162
 
163 163
         // Validate foreign key behavior
164
-        if (isset($config['on_delete'])) {
164
+        if ( isset($config['on_delete']) ) {
165 165
             $validOnDelete = ['cascade', 'set null', 'restrict', 'no action'];
166
-            if (! in_array($config['on_delete'], $validOnDelete)) {
166
+            if ( !in_array($config['on_delete'], $validOnDelete) ) {
167 167
                 $errors[] = "Invalid on_delete value for {$columnType}: {$config['on_delete']}. Valid values are: ".implode(', ', $validOnDelete);
168 168
             }
169 169
         }
170 170
 
171
-        if (isset($config['on_update'])) {
171
+        if ( isset($config['on_update']) ) {
172 172
             $validOnUpdate = ['cascade', 'set null', 'restrict', 'no action'];
173
-            if (! in_array($config['on_update'], $validOnUpdate)) {
173
+            if ( !in_array($config['on_update'], $validOnUpdate) ) {
174 174
                 $errors[] = "Invalid on_update value for {$columnType}: {$config['on_update']}. Valid values are: ".implode(', ', $validOnUpdate);
175 175
             }
176 176
         }
@@ -187,36 +187,36 @@  discard block
 block discarded – undo
187 187
         $customTypes = Config::get('userstamps.custom_column_types', []);
188 188
 
189 189
         // If no custom column types are set, use defaults
190
-        if (empty($customTypes)) {
190
+        if ( empty($customTypes) ) {
191 191
             return $errors;
192 192
         }
193 193
 
194 194
         foreach ($customTypes as $typeName => $typeConfig) {
195
-            if (! is_array($typeConfig)) {
195
+            if ( !is_array($typeConfig) ) {
196 196
                 $errors[] = "Custom column type '{$typeName}' must be an array";
197 197
 
198 198
                 continue;
199 199
             }
200 200
 
201
-            if (! isset($typeConfig['method'])) {
201
+            if ( !isset($typeConfig['method']) ) {
202 202
                 $errors[] = "Custom column type '{$typeName}' is missing 'method' field";
203 203
 
204 204
                 continue;
205 205
             }
206 206
 
207
-            if (! is_string($typeConfig['method'])) {
207
+            if ( !is_string($typeConfig['method']) ) {
208 208
                 $errors[] = "Method for custom column type '{$typeName}' must be a string";
209 209
 
210 210
                 continue;
211 211
             }
212 212
 
213
-            if (! isset($typeConfig['parameters'])) {
213
+            if ( !isset($typeConfig['parameters']) ) {
214 214
                 $errors[] = "Custom column type '{$typeName}' is missing 'parameters' field";
215 215
 
216 216
                 continue;
217 217
             }
218 218
 
219
-            if (! is_array($typeConfig['parameters'])) {
219
+            if ( !is_array($typeConfig['parameters']) ) {
220 220
                 $errors[] = "Parameters for custom column type '{$typeName}' must be an array";
221 221
 
222 222
                 continue;
@@ -235,35 +235,35 @@  discard block
 block discarded – undo
235 235
         $advanced = Config::get('userstamps.advanced', []);
236 236
 
237 237
         // If no advanced configuration is set, use defaults
238
-        if (empty($advanced)) {
238
+        if ( empty($advanced) ) {
239 239
             return $errors;
240 240
         }
241 241
 
242 242
         // Validate boolean fields
243 243
         $booleanFields = ['foreign_keys', 'indexes', 'comments', 'sqlite_compatibility'];
244 244
         foreach ($booleanFields as $field) {
245
-            if (isset($advanced[$field]) && ! is_bool($advanced[$field])) {
245
+            if ( isset($advanced[$field]) && !is_bool($advanced[$field]) ) {
246 246
                 $errors[] = "Advanced configuration field '{$field}' must be a boolean";
247 247
             }
248 248
         }
249 249
 
250 250
         // Validate foreign key behavior
251
-        if (isset($advanced['default_foreign_key_behavior'])) {
251
+        if ( isset($advanced['default_foreign_key_behavior']) ) {
252 252
             $behavior = $advanced['default_foreign_key_behavior'];
253 253
 
254
-            if (! is_array($behavior)) {
254
+            if ( !is_array($behavior) ) {
255 255
                 $errors[] = 'Default foreign key behavior must be an array';
256 256
             } else {
257
-                if (isset($behavior['on_delete'])) {
257
+                if ( isset($behavior['on_delete']) ) {
258 258
                     $validOnDelete = ['cascade', 'set null', 'restrict', 'no action'];
259
-                    if (! in_array($behavior['on_delete'], $validOnDelete)) {
259
+                    if ( !in_array($behavior['on_delete'], $validOnDelete) ) {
260 260
                         $errors[] = "Invalid default on_delete value: {$behavior['on_delete']}";
261 261
                     }
262 262
                 }
263 263
 
264
-                if (isset($behavior['on_update'])) {
264
+                if ( isset($behavior['on_update']) ) {
265 265
                     $validOnUpdate = ['cascade', 'set null', 'restrict', 'no action'];
266
-                    if (! in_array($behavior['on_update'], $validOnUpdate)) {
266
+                    if ( !in_array($behavior['on_update'], $validOnUpdate) ) {
267 267
                         $errors[] = "Invalid default on_update value: {$behavior['on_update']}";
268 268
                     }
269 269
                 }
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
         }
272 272
 
273 273
         // Validate column name validation
274
-        if (isset($advanced['column_name_validation'])) {
274
+        if ( isset($advanced['column_name_validation']) ) {
275 275
             $validation = $advanced['column_name_validation'];
276 276
 
277
-            if (! is_array($validation)) {
277
+            if ( !is_array($validation) ) {
278 278
                 $errors[] = 'Column name validation must be an array';
279 279
             } else {
280
-                if (isset($validation['pattern']) && ! is_string($validation['pattern'])) {
280
+                if ( isset($validation['pattern']) && !is_string($validation['pattern']) ) {
281 281
                     $errors[] = 'Column name validation pattern must be a string';
282 282
                 }
283 283
 
284
-                if (isset($validation['max_length']) && ! is_numeric($validation['max_length'])) {
284
+                if ( isset($validation['max_length']) && !is_numeric($validation['max_length']) ) {
285 285
                     $errors[] = 'Column name validation max_length must be a number';
286 286
                 }
287 287
             }
Please login to merge, or discard this patch.
src/Database/Schema/Macros/UserStampsMacro.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
             // Get the actual column name from config or use default
145 145
             // Support both old format (created_by_column) and new format (columns.created_by.name)
146 146
             $columnName = $config['name'] ??
147
-                         config("userstamps.{$columnType}_column") ??
148
-                         config("userstamps.columns.{$columnType}.name", $columnType);
147
+                            config("userstamps.{$columnType}_column") ??
148
+                            config("userstamps.columns.{$columnType}.name", $columnType);
149 149
 
150 150
             // For backward compatibility, also check the legacy column names
151 151
             if ($columnType === 'created_by') {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             foreach ($columns as $columnType) {
252 252
                 // Support both old format (created_by_column) and new format (columns.created_by.name)
253 253
                 $columnName = config("userstamps.{$columnType}_column") ??
254
-                             config("userstamps.columns.{$columnType}.name", $columnType);
254
+                                config("userstamps.columns.{$columnType}.name", $columnType);
255 255
 
256 256
                 // For backward compatibility, also check the legacy column names
257 257
                 if ($columnType === 'created_by') {
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     private function registerUserstamps()
39 39
     {
40
-        Blueprint::macro('userstamps', function ($options = []) {
40
+        Blueprint::macro('userstamps', function($options = []) {
41 41
             $config = $this->getUserstampsConfig('userstamps', $options);
42 42
 
43 43
             foreach (['created_by', 'updated_by'] as $columnType) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     private function registerSoftUserstamps()
52 52
     {
53
-        Blueprint::macro('softUserstamps', function ($options = []) {
53
+        Blueprint::macro('softUserstamps', function($options = []) {
54 54
             $config = $this->getUserstampsConfig('softUserstamps', $options);
55 55
 
56 56
             $this->createUserstampColumn('deleted_by', $config['deleted_by']);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     private function registerCustomUserstamps()
63 63
     {
64
-        Blueprint::macro('customUserstamps', function ($columns = [], $options = []) {
64
+        Blueprint::macro('customUserstamps', function($columns = [], $options = []) {
65 65
             $config = $this->getUserstampsConfig('custom', $options);
66 66
 
67 67
             foreach ($columns as $columnName => $columnConfig) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
     private function registerDropUserstamps()
77 77
     {
78
-        Blueprint::macro('dropUserstamps', function ($options = []) {
78
+        Blueprint::macro('dropUserstamps', function($options = []) {
79 79
             $config = $this->getUserstampsConfig('dropUserstamps', $options);
80 80
             $columns = ['created_by', 'updated_by'];
81 81
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
     private function registerDropSoftUserstamps()
89 89
     {
90
-        Blueprint::macro('dropSoftUserstamps', function ($options = []) {
90
+        Blueprint::macro('dropSoftUserstamps', function($options = []) {
91 91
             $config = $this->getUserstampsConfig('dropSoftUserstamps', $options);
92 92
             $columns = ['deleted_by'];
93 93
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function registerHelperMethods()
104 104
     {
105
-        Blueprint::macro('getUserstampsConfig', function ($type, $options = []) {
105
+        Blueprint::macro('getUserstampsConfig', function($type, $options = []) {
106 106
             $baseConfig = config('userstamps.columns', []);
107 107
             $defaultConfig = [
108 108
                 'created_by' => $baseConfig['created_by'] ?? [],
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
             }
130 130
 
131 131
             // Merge with provided options
132
-            if (! empty($options)) {
132
+            if ( !empty($options) ) {
133 133
                 foreach ($options as $key => $value) {
134
-                    if (isset($defaultConfig[$key])) {
134
+                    if ( isset($defaultConfig[$key]) ) {
135 135
                         $defaultConfig[$key] = array_merge($defaultConfig[$key], $value);
136 136
                     }
137 137
                 }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             return $defaultConfig;
141 141
         });
142 142
 
143
-        Blueprint::macro('createUserstampColumn', function ($columnType, $config) {
143
+        Blueprint::macro('createUserstampColumn', function($columnType, $config) {
144 144
             // Get the actual column name from config or use default
145 145
             // Support both old format (created_by_column) and new format (columns.created_by.name)
146 146
             $columnName = $config['name'] ??
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
                          config("userstamps.columns.{$columnType}.name", $columnType);
149 149
 
150 150
             // For backward compatibility, also check the legacy column names
151
-            if ($columnType === 'created_by') {
151
+            if ( $columnType === 'created_by' ) {
152 152
                 $columnName = $config['name'] ?? config('userstamps.created_by_column', 'created_by');
153
-            } elseif ($columnType === 'updated_by') {
153
+            } elseif ( $columnType === 'updated_by' ) {
154 154
                 $columnName = $config['name'] ?? config('userstamps.updated_by_column', 'updated_by');
155
-            } elseif ($columnType === 'deleted_by') {
155
+            } elseif ( $columnType === 'deleted_by' ) {
156 156
                 $columnName = $config['name'] ?? config('userstamps.deleted_by_column', 'deleted_by');
157 157
             }
158 158
 
159 159
             // Ensure we have a valid column name
160
-            if (empty($columnName)) {
160
+            if ( empty($columnName) ) {
161 161
                 $columnName = $columnType;
162 162
             }
163 163
 
@@ -170,30 +170,30 @@  discard block
 block discarded – undo
170 170
             $column = $this->createUserstampColumnByType($columnName, $columnTypeMethod, $config);
171 171
 
172 172
             // Add nullable if specified
173
-            if ($config['nullable'] ?? true) {
173
+            if ( $config['nullable'] ?? true ) {
174 174
                 $column->nullable();
175 175
             }
176 176
 
177 177
             // Add index if specified
178
-            if ($config['index'] ?? config('userstamps.advanced.indexes', true)) {
178
+            if ( $config['index'] ?? config('userstamps.advanced.indexes', true) ) {
179 179
                 $column->index();
180 180
             }
181 181
 
182 182
             // Add comment if enabled and specified
183
-            if (config('userstamps.advanced.comments', false) && isset($config['comment'])) {
183
+            if ( config('userstamps.advanced.comments', false) && isset($config['comment']) ) {
184 184
                 $column->comment($config['comment']);
185 185
             }
186 186
 
187 187
             // Add foreign key if specified
188
-            if ($config['foreign_key'] ?? config('userstamps.advanced.foreign_keys', true)) {
188
+            if ( $config['foreign_key'] ?? config('userstamps.advanced.foreign_keys', true) ) {
189 189
                 $this->addUserstampForeignKeyConstraint($columnName, $config);
190 190
             }
191 191
         });
192 192
 
193
-        Blueprint::macro('createUserstampColumnByType', function ($columnName, $type, $config) {
193
+        Blueprint::macro('createUserstampColumnByType', function($columnName, $type, $config) {
194 194
             $customTypes = config('userstamps.custom_column_types', []);
195 195
 
196
-            if (isset($customTypes[$type])) {
196
+            if ( isset($customTypes[$type]) ) {
197 197
                 $typeConfig = $customTypes[$type];
198 198
                 $method = $typeConfig['method'];
199 199
                 $parameters = array_merge([$columnName], $typeConfig['parameters'] ?? []);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             return $this->createDefaultUserstampColumn($columnName, $type);
206 206
         });
207 207
 
208
-        Blueprint::macro('createDefaultUserstampColumn', function ($columnName, $type) {
208
+        Blueprint::macro('createDefaultUserstampColumn', function($columnName, $type) {
209 209
             switch ($type) {
210 210
                 case 'bigIncrements':
211 211
                     return $this->unsignedBigInteger($columnName);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             }
231 231
         });
232 232
 
233
-        Blueprint::macro('addUserstampForeignKeyConstraint', function ($columnName, $config) {
233
+        Blueprint::macro('addUserstampForeignKeyConstraint', function($columnName, $config) {
234 234
             $onDelete = $config['on_delete'] ?? config('userstamps.advanced.default_foreign_key_behavior.on_delete', 'set null');
235 235
             $onUpdate = $config['on_update'] ?? config('userstamps.advanced.default_foreign_key_behavior.on_update', 'cascade');
236 236
 
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
                 ->onUpdate($onUpdate);
242 242
         });
243 243
 
244
-        Blueprint::macro('dropUserstampColumns', function ($columns, $config) {
244
+        Blueprint::macro('dropUserstampColumns', function($columns, $config) {
245 245
             // Check SQLite compatibility
246
-            if (config('userstamps.advanced.sqlite_compatibility', true) &&
247
-                DB::connection() instanceof SQLiteConnection) {
246
+            if ( config('userstamps.advanced.sqlite_compatibility', true) &&
247
+                DB::connection() instanceof SQLiteConnection ) {
248 248
                 return $this;
249 249
             }
250 250
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
                              config("userstamps.columns.{$columnType}.name", $columnType);
255 255
 
256 256
                 // For backward compatibility, also check the legacy column names
257
-                if ($columnType === 'created_by') {
257
+                if ( $columnType === 'created_by' ) {
258 258
                     $columnName = config('userstamps.created_by_column', 'created_by');
259
-                } elseif ($columnType === 'updated_by') {
259
+                } elseif ( $columnType === 'updated_by' ) {
260 260
                     $columnName = config('userstamps.updated_by_column', 'updated_by');
261
-                } elseif ($columnType === 'deleted_by') {
261
+                } elseif ( $columnType === 'deleted_by' ) {
262 262
                     $columnName = config('userstamps.deleted_by_column', 'deleted_by');
263 263
                 }
264 264
 
265 265
                 // Drop foreign key if enabled
266
-                if (config('userstamps.advanced.foreign_keys', true)) {
266
+                if ( config('userstamps.advanced.foreign_keys', true) ) {
267 267
                     try {
268 268
                         $this->dropForeign([$columnName]);
269 269
                     } catch (\Exception $e) {
@@ -280,18 +280,18 @@  discard block
 block discarded – undo
280 280
             }
281 281
         });
282 282
 
283
-        Blueprint::macro('validateUserstampColumnName', function ($columnName) {
283
+        Blueprint::macro('validateUserstampColumnName', function($columnName) {
284 284
             $validation = config('userstamps.advanced.column_name_validation', []);
285 285
 
286
-            if (isset($validation['pattern'])) {
287
-                if (! preg_match($validation['pattern'], $columnName)) {
286
+            if ( isset($validation['pattern']) ) {
287
+                if ( !preg_match($validation['pattern'], $columnName) ) {
288 288
                     throw new \InvalidArgumentException(
289 289
                         "Column name '{$columnName}' does not match the required pattern."
290 290
                     );
291 291
                 }
292 292
             }
293 293
 
294
-            if (isset($validation['max_length']) && strlen($columnName) > $validation['max_length']) {
294
+            if ( isset($validation['max_length']) && strlen($columnName) > $validation['max_length'] ) {
295 295
                 throw new \InvalidArgumentException(
296 296
                     "Column name '{$columnName}' exceeds maximum length of {$validation['max_length']} characters."
297 297
                 );
Please login to merge, or discard this patch.
src/Observers/UserStampObserver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function deleting(Model $model)
37 37
     {
38
-        if ($model->usingSoftDeletes()) {
38
+        if ( $model->usingSoftDeletes() ) {
39 39
             $model->{config('userstamps.deleted_by_column')} = $this->getUsersPrimaryValue();
40 40
             $model->{config('userstamps.updated_by_column')} = $this->getUsersPrimaryValue();
41 41
             $this->saveWithoutEventDispatching($model);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function restoring(Model $model)
51 51
     {
52
-        if ($model->usingSoftDeletes()) {
52
+        if ( $model->usingSoftDeletes() ) {
53 53
             $model->{config('userstamps.deleted_by_column')} = null;
54 54
             $model->{config('userstamps.updated_by_column')} = $this->getUsersPrimaryValue();
55 55
             $this->saveWithoutEventDispatching($model);
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function getUsersPrimaryValue()
82 82
     {
83
-        if (! Auth::check()) {
83
+        if ( !Auth::check() ) {
84 84
             return null;
85 85
         }
86 86
 
87
-        if (config('userstamps.users_table_column_id_name') !== 'id') {
87
+        if ( config('userstamps.users_table_column_id_name') !== 'id' ) {
88 88
             return Auth::user()->{config('userstamps.users_table_column_id_name')};
89 89
         }
90 90
 
Please login to merge, or discard this patch.