We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // If no model was found, we will generate the path to the location where this class file |
67 | 67 | // should be written. Then, we will build the class and make the proper replacements on |
68 | 68 | // the stub files so that it gets the correctly formatted namespace and class name. |
69 | - if (! $existsOnApp && ! $existsOnModels) { |
|
69 | + if (!$existsOnApp && !$existsOnModels) { |
|
70 | 70 | $this->makeDirectory($namespaceModels); |
71 | 71 | |
72 | 72 | $this->files->put($this->getPath($namespaceModels), $this->sortImports($this->buildClass($namespaceModels))); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | // As the class already exists, we don't want to create the class and overwrite the |
98 | 98 | // user's code. We just make sure it uses CrudTrait. We add that one line. |
99 | - if (! $this->hasOption('force') || ! $this->option('force')) { |
|
99 | + if (!$this->hasOption('force') || !$this->option('force')) { |
|
100 | 100 | $this->progressBlock('Adding CrudTrait to model'); |
101 | 101 | |
102 | 102 | $file = $this->files->get($path); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if (Str::endsWith($line, '{')) { |
117 | 117 | // add the trait on the next |
118 | 118 | $position = $key + 1; |
119 | - } elseif ($lines[$key + 1] == '{') { |
|
119 | + } elseif ($lines[ $key + 1 ] == '{') { |
|
120 | 120 | // add the trait on the next next line |
121 | 121 | $position = $key + 2; |
122 | 122 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | $this->infoBlock("Creating CRUD for the <fg=blue>$nameTitle</> model:"); |
46 | 46 | |
47 | 47 | // Create the CRUD Model and show output |
48 | - $this->call('backpack:crud-model', ['name' => $nameTitle]); |
|
48 | + $this->call('backpack:crud-model', [ 'name' => $nameTitle ]); |
|
49 | 49 | |
50 | 50 | // Create the CRUD Controller and show output |
51 | - $this->call('backpack:crud-controller', ['name' => $nameTitle]); |
|
51 | + $this->call('backpack:crud-controller', [ 'name' => $nameTitle ]); |
|
52 | 52 | |
53 | 53 | // Create the CRUD Request and show output |
54 | - $this->call('backpack:crud-request', ['name' => $nameTitle]); |
|
54 | + $this->call('backpack:crud-request', [ 'name' => $nameTitle ]); |
|
55 | 55 | |
56 | 56 | // Create the CRUD route |
57 | 57 | $this->call('backpack:add-custom-route', [ |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // Next, We will check to see if the class already exists. If it does, we don't want |
56 | 56 | // to create the class and overwrite the user's code. So, we will bail out so the |
57 | 57 | // code is untouched. Otherwise, we will continue generating this class' files. |
58 | - if ((! $this->hasOption('force') || ! $this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
58 | + if ((!$this->hasOption('force') || !$this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
59 | 59 | $this->closeProgressBlock('Already existed', 'yellow'); |
60 | 60 | |
61 | 61 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
83 | 83 | |
84 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
84 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | protected function getAttributes($model) |
131 | 131 | { |
132 | - $attributes = []; |
|
132 | + $attributes = [ ]; |
|
133 | 133 | $model = new $model(); |
134 | 134 | |
135 | 135 | // if fillable was defined, use that as the attributes |
@@ -155,24 +155,24 @@ discard block |
||
155 | 155 | $class = Str::afterLast($name, '\\'); |
156 | 156 | $model = "App\\Models\\$class"; |
157 | 157 | |
158 | - if (! class_exists($model)) { |
|
158 | + if (!class_exists($model)) { |
|
159 | 159 | return $this; |
160 | 160 | } |
161 | 161 | |
162 | 162 | $attributes = $this->getAttributes($model); |
163 | 163 | |
164 | 164 | // create an array with the needed code for defining fields |
165 | - $fields = Arr::except($attributes, ['id', 'created_at', 'updated_at', 'deleted_at']); |
|
165 | + $fields = Arr::except($attributes, [ 'id', 'created_at', 'updated_at', 'deleted_at' ]); |
|
166 | 166 | $fields = collect($fields) |
167 | - ->map(function ($field) { |
|
167 | + ->map(function($field) { |
|
168 | 168 | return "CRUD::field('$field');"; |
169 | 169 | }) |
170 | 170 | ->toArray(); |
171 | 171 | |
172 | 172 | // create an array with the needed code for defining columns |
173 | - $columns = Arr::except($attributes, ['id']); |
|
173 | + $columns = Arr::except($attributes, [ 'id' ]); |
|
174 | 174 | $columns = collect($columns) |
175 | - ->map(function ($column) { |
|
175 | + ->map(function($column) { |
|
176 | 176 | return "CRUD::column('$column');"; |
177 | 177 | }) |
178 | 178 | ->toArray(); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | protected function replaceModel(&$stub, $name) |
195 | 195 | { |
196 | 196 | $class = str_replace($this->getNamespace($name).'\\', '', $name); |
197 | - $stub = str_replace(['DummyClass', '{{ class }}', '{{class}}'], $class, $stub); |
|
197 | + $stub = str_replace([ 'DummyClass', '{{ class }}', '{{class}}' ], $class, $stub); |
|
198 | 198 | |
199 | 199 | return $this; |
200 | 200 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // Next, We will check to see if the class already exists. If it does, we don't want |
54 | 54 | // to create the class and overwrite the user's code. So, we will bail out so the |
55 | 55 | // code is untouched. Otherwise, we will continue generating this class' files. |
56 | - if ((! $this->hasOption('force') || ! $this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
56 | + if ((!$this->hasOption('force') || !$this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
57 | 57 | $this->closeProgressBlock('Already existed', 'yellow'); |
58 | 58 | |
59 | 59 | return false; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
81 | 81 | |
82 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Request.php'; |
|
82 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'Request.php'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | // make a list of all models |
35 | 35 | $models = $this->getModels(base_path('app')); |
36 | 36 | |
37 | - if (! count($models)) { |
|
37 | + if (!count($models)) { |
|
38 | 38 | $this->errorBlock('No models found.'); |
39 | 39 | |
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | 43 | foreach ($models as $key => $model) { |
44 | - $this->call('backpack:crud', ['name' => $model]); |
|
44 | + $this->call('backpack:crud', [ 'name' => $model ]); |
|
45 | 45 | $this->line(' <fg=gray>----------</>'); |
46 | 46 | } |
47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | private function getModels($path) |
52 | 52 | { |
53 | - $out = []; |
|
53 | + $out = [ ]; |
|
54 | 54 | $results = scandir($path); |
55 | 55 | |
56 | 56 | foreach ($results as $result) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $file_content = file_get_contents($filename); |
66 | 66 | if (Str::contains($file_content, 'Illuminate\Database\Eloquent\Model') && |
67 | 67 | Str::contains($file_content, 'extends Model')) { |
68 | - $out[] = Arr::last(explode('/', substr($filename, 0, -4))); |
|
68 | + $out[ ] = Arr::last(explode('/', substr($filename, 0, -4))); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |