We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // Next, We will check to see if the class already exists. If it does, we don't want |
59 | 59 | // to create the class and overwrite the user's code. So, we will bail out so the |
60 | 60 | // code is untouched. Otherwise, we will continue generating this class' files. |
61 | - if ((! $this->hasOption('force') || ! $this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
61 | + if ((!$this->hasOption('force') || !$this->option('force')) && $this->alreadyExists($this->getNameInput())) { |
|
62 | 62 | $this->closeProgressBlock('Already existed', 'yellow'); |
63 | 63 | |
64 | 64 | return false; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
86 | 86 | |
87 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
87 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | protected function getAttributes($model) |
135 | 135 | { |
136 | - $attributes = []; |
|
136 | + $attributes = [ ]; |
|
137 | 137 | $model = new $model(); |
138 | 138 | |
139 | 139 | // if fillable was defined, use that as the attributes |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | $class = Str::afterLast($name, '\\'); |
160 | 160 | $model = "App\\Models\\$class"; |
161 | 161 | |
162 | - if (! class_exists($model)) { |
|
162 | + if (!class_exists($model)) { |
|
163 | 163 | return $this; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $attributes = $this->getAttributes($model); |
167 | - $fields = array_diff($attributes, ['id', 'created_at', 'updated_at', 'deleted_at']); |
|
168 | - $columns = array_diff($attributes, ['id']); |
|
167 | + $fields = array_diff($attributes, [ 'id', 'created_at', 'updated_at', 'deleted_at' ]); |
|
168 | + $columns = array_diff($attributes, [ 'id' ]); |
|
169 | 169 | $glue = PHP_EOL.' '; |
170 | 170 | |
171 | 171 | // create an array with the needed code for defining fields |
172 | 172 | $fields = collect($fields) |
173 | - ->map(function ($field) { |
|
173 | + ->map(function($field) { |
|
174 | 174 | return "CRUD::field('$field');"; |
175 | 175 | }) |
176 | 176 | ->join($glue); |
177 | 177 | |
178 | 178 | // create an array with the needed code for defining columns |
179 | 179 | $columns = collect($columns) |
180 | - ->map(function ($column) { |
|
180 | + ->map(function($column) { |
|
181 | 181 | return "CRUD::column('$column');"; |
182 | 182 | }) |
183 | 183 | ->join($glue); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | protected function replaceModel(&$stub, $name) |
200 | 200 | { |
201 | 201 | $class = str_replace($this->getNamespace($name).'\\', '', $name); |
202 | - $stub = str_replace(['DummyClass', '{{ class }}', '{{class}}'], $this->buildClassName($name), $stub); |
|
202 | + $stub = str_replace([ 'DummyClass', '{{ class }}', '{{class}}' ], $this->buildClassName($name), $stub); |
|
203 | 203 | |
204 | 204 | return $this; |
205 | 205 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
47 | 47 | |
48 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Operation.php'; |
|
48 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'Operation.php'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -58,8 +58,7 @@ |
||
58 | 58 | { |
59 | 59 | if ($this->sourceViewNamespace) { |
60 | 60 | $themePath = Str::contains($this->sourceViewNamespace, '::') ? |
61 | - Str::before($this->sourceViewNamespace, '::') : |
|
62 | - Str::beforeLast($this->sourceViewNamespace, '.'); |
|
61 | + Str::before($this->sourceViewNamespace, '::') : Str::beforeLast($this->sourceViewNamespace, '.'); |
|
63 | 62 | |
64 | 63 | $themePath = Str::replace('.', '/', $themePath); |
65 | 64 |
@@ -105,7 +105,7 @@ |
||
105 | 105 | $this->sourceFile = realpath(substr($from, 1)); |
106 | 106 | } |
107 | 107 | |
108 | - if (! $this->sourceFile) { |
|
108 | + if (!$this->sourceFile) { |
|
109 | 109 | $this->errorProgressBlock(); |
110 | 110 | $this->note("$this->type '$from' does not exist!", 'red'); |
111 | 111 | $this->newLine(); |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | |
48 | 48 | // Validate validation option |
49 | 49 | $validation = $this->handleValidationOption(); |
50 | - if (! $validation) { |
|
50 | + if (!$validation) { |
|
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Create the CRUD Model and show output |
55 | - $this->call('backpack:crud-model', ['name' => $name]); |
|
55 | + $this->call('backpack:crud-model', [ 'name' => $name ]); |
|
56 | 56 | |
57 | 57 | // Create the CRUD Controller and show output |
58 | - $this->call('backpack:crud-controller', ['name' => $name, '--validation' => $validation]); |
|
58 | + $this->call('backpack:crud-controller', [ 'name' => $name, '--validation' => $validation ]); |
|
59 | 59 | |
60 | 60 | // Create the CRUD Request and show output |
61 | 61 | if ($validation === 'request') { |
62 | - $this->call('backpack:crud-request', ['name' => $name]); |
|
62 | + $this->call('backpack:crud-request', [ 'name' => $name ]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Create the CRUD route |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // Create the menu item |
71 | 71 | $this->call('backpack:add-menu-content', [ |
72 | - 'code' => "<x-backpack::menu-item title=\"". $fullNameWithSpaces ."\" icon=\"la la-question\" :link=\"backpack_url('".$nameKebab."')\" />", |
|
72 | + 'code' => "<x-backpack::menu-item title=\"".$fullNameWithSpaces."\" icon=\"la la-question\" :link=\"backpack_url('".$nameKebab."')\" />", |
|
73 | 73 | ]); |
74 | 74 | |
75 | 75 | // if the application uses cached routes, we should rebuild the cache so the previous added route will |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private function handleValidationOption() |
94 | 94 | { |
95 | - $options = ['request', 'array', 'field']; |
|
95 | + $options = [ 'request', 'array', 'field' ]; |
|
96 | 96 | |
97 | 97 | // Validate validation option |
98 | 98 | $validation = $this->option('validation'); |
99 | 99 | |
100 | - if (! $validation) { |
|
100 | + if (!$validation) { |
|
101 | 101 | $validation = $this->askHint( |
102 | 102 | 'How would you like to define your validation rules, for the Create and Update operations?', [ |
103 | 103 | 'More info at <fg=blue>https://backpackforlaravel.com/docs/5.x/crud-operation-create#validation</>', |
104 | 104 | 'Valid options are <fg=blue>request</>, <fg=blue>array</> or <fg=blue>field</>', |
105 | - ], $options[0]); |
|
105 | + ], $options[ 0 ]); |
|
106 | 106 | |
107 | - if (! $this->option('no-interaction')) { |
|
107 | + if (!$this->option('no-interaction')) { |
|
108 | 108 | $this->deleteLines(5); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if (! in_array($validation, $options)) { |
|
112 | + if (!in_array($validation, $options)) { |
|
113 | 113 | $this->errorBlock("The validation must be request, array or field. '$validation' is not valid."); |
114 | 114 | |
115 | 115 | return false; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->progressBlock("Creating view <fg=blue>resources/views/{$filePath}.blade.php</>"); |
74 | 74 | |
75 | 75 | // check if the file already exists |
76 | - if ((! $this->hasOption('force') || ! $this->option('force')) && $this->alreadyExists($filePath)) { |
|
76 | + if ((!$this->hasOption('force') || !$this->option('force')) && $this->alreadyExists($filePath)) { |
|
77 | 77 | $this->closeProgressBlock('Already existed', 'yellow'); |
78 | 78 | |
79 | 79 | return false; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // create the menu item |
104 | 104 | $this->call('backpack:add-menu-content', [ |
105 | - 'code' => "<x-backpack::menu-item title=\"" . $nameTitle . "\" icon=\"la la-question\" :link=\"backpack_url('" . $route . "')\" />", |
|
105 | + 'code' => "<x-backpack::menu-item title=\"".$nameTitle."\" icon=\"la la-question\" :link=\"backpack_url('".$route."')\" />", |
|
106 | 106 | ]); |
107 | 107 | |
108 | 108 | $url = backpack_url($route); |