We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // Next, We will check to see if the class already exists. If it does, we don't want |
60 | 60 | // to create the class and overwrite the user's code. So, we will bail out so the |
61 | 61 | // code is untouched. Otherwise, we will continue generating this class' files. |
62 | - if ((! $this->hasOption('force') || ! $this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
62 | + if ((!$this->hasOption('force') || !$this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
63 | 63 | $this->closeProgressBlock('Already existed', 'yellow'); |
64 | 64 | |
65 | 65 | return false; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
87 | 87 | |
88 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
88 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | protected function getAttributes($model) |
136 | 136 | { |
137 | - $attributes = []; |
|
137 | + $attributes = [ ]; |
|
138 | 138 | $model = new $model(); |
139 | 139 | |
140 | 140 | // if fillable was defined, use that as the attributes |
@@ -160,25 +160,25 @@ discard block |
||
160 | 160 | $class = Str::afterLast($name, '\\'); |
161 | 161 | $model = "App\\Models\\$class"; |
162 | 162 | |
163 | - if (! class_exists($model)) { |
|
163 | + if (!class_exists($model)) { |
|
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $attributes = $this->getAttributes($model); |
168 | - $fields = array_diff($attributes, ['id', 'created_at', 'updated_at', 'deleted_at']); |
|
169 | - $columns = array_diff($attributes, ['id']); |
|
168 | + $fields = array_diff($attributes, [ 'id', 'created_at', 'updated_at', 'deleted_at' ]); |
|
169 | + $columns = array_diff($attributes, [ 'id' ]); |
|
170 | 170 | $glue = PHP_EOL.' '; |
171 | 171 | |
172 | 172 | // create an array with the needed code for defining fields |
173 | 173 | $fields = collect($fields) |
174 | - ->map(function ($field) { |
|
174 | + ->map(function($field) { |
|
175 | 175 | return "CRUD::field('$field');"; |
176 | 176 | }) |
177 | 177 | ->join($glue); |
178 | 178 | |
179 | 179 | // create an array with the needed code for defining columns |
180 | 180 | $columns = collect($columns) |
181 | - ->map(function ($column) { |
|
181 | + ->map(function($column) { |
|
182 | 182 | return "CRUD::column('$column');"; |
183 | 183 | }) |
184 | 184 | ->join($glue); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | protected function replaceModel(&$stub, $name) |
201 | 201 | { |
202 | 202 | $class = str_replace($this->getNamespace($name).'\\', '', $name); |
203 | - $stub = str_replace(['DummyClass', '{{ class }}', '{{class}}'], $this->buildClassName($name), $stub); |
|
203 | + $stub = str_replace([ 'DummyClass', '{{ class }}', '{{class}}' ], $this->buildClassName($name), $stub); |
|
204 | 204 | |
205 | 205 | return $this; |
206 | 206 | } |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | $stub = str_replace(' CRUD::setValidation(DummyClassRequest::class);'.PHP_EOL, '', $stub); |
227 | 227 | } |
228 | 228 | |
229 | - if($validation !== 'request') { |
|
229 | + if ($validation !== 'request') { |
|
230 | 230 | $stub = str_replace('use App\Http\Requests\DummyModelClassRequest;', '', $stub); |
231 | - }else{ |
|
231 | + } else { |
|
232 | 232 | // add a new line after the use statement |
233 | 233 | $stub = str_replace('use App\Http\Requests\DummyModelClassRequest;', "use App\Http\Requests\DummyModelClassRequest;\n", $stub); |
234 | 234 | } |
@@ -228,7 +228,7 @@ |
||
228 | 228 | |
229 | 229 | if($validation !== 'request') { |
230 | 230 | $stub = str_replace('use App\Http\Requests\DummyModelClassRequest;', '', $stub); |
231 | - }else{ |
|
231 | + } else{ |
|
232 | 232 | // add a new line after the use statement |
233 | 233 | $stub = str_replace('use App\Http\Requests\DummyModelClassRequest;', "use App\Http\Requests\DummyModelClassRequest;\n", $stub); |
234 | 234 | } |