We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | */ |
| 91 | 91 | protected function getPath($name) |
| 92 | 92 | { |
| 93 | - return $this->laravel['path'].'/../resources/views/'.str_replace('\\', '/', $name).'.blade.php'; |
|
| 93 | + return $this->laravel[ 'path' ].'/../resources/views/'.str_replace('\\', '/', $name).'.blade.php'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | */ |
| 89 | 89 | protected function getPath($name) |
| 90 | 90 | { |
| 91 | - return $this->laravel['path'].'/../config/'.str_replace('\\', '/', $name).'.php'; |
|
| 91 | + return $this->laravel[ 'path' ].'/../config/'.str_replace('\\', '/', $name).'.php'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // If no model was found, we will generate the path to the location where this class file |
| 63 | 63 | // should be written. Then, we will build the class and make the proper replacements on |
| 64 | 64 | // the stub files so that it gets the correctly formatted namespace and class name. |
| 65 | - if (! $existsOnApp && ! $existsOnModels) { |
|
| 65 | + if (!$existsOnApp && !$existsOnModels) { |
|
| 66 | 66 | $this->makeDirectory($namespaceModels); |
| 67 | 67 | |
| 68 | 68 | $this->files->put($this->getPath($namespaceModels), $this->sortImports($this->buildClass($namespaceModels))); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // As the class already exists, we don't want to create the class and overwrite the |
| 91 | 91 | // user's code. We just make sure it uses CrudTrait. We add that one line. |
| 92 | - if (! $this->hasOption('force') || ! $this->option('force')) { |
|
| 92 | + if (!$this->hasOption('force') || !$this->option('force')) { |
|
| 93 | 93 | $file = $this->files->get($path); |
| 94 | 94 | $lines = preg_split('/(\r\n)|\r|\n/', $file); |
| 95 | 95 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | if (Str::endsWith($line, '{')) { |
| 108 | 108 | // add the trait on the next |
| 109 | 109 | $position = $key + 1; |
| 110 | - } elseif ($lines[$key + 1] == '{') { |
|
| 110 | + } elseif ($lines[ $key + 1 ] == '{') { |
|
| 111 | 111 | // add the trait on the next next line |
| 112 | 112 | $position = $key + 2; |
| 113 | 113 | } |
@@ -34,13 +34,13 @@ |
||
| 34 | 34 | $namePlural = ucfirst(str_replace('-', ' ', Str::plural($nameKebab))); |
| 35 | 35 | |
| 36 | 36 | // Create the CRUD Model and show output |
| 37 | - $this->call('backpack:crud-model', ['name' => $nameTitle]); |
|
| 37 | + $this->call('backpack:crud-model', [ 'name' => $nameTitle ]); |
|
| 38 | 38 | |
| 39 | 39 | // Create the CRUD Controller and show output |
| 40 | - $this->call('backpack:crud-controller', ['name' => $nameTitle]); |
|
| 40 | + $this->call('backpack:crud-controller', [ 'name' => $nameTitle ]); |
|
| 41 | 41 | |
| 42 | 42 | // Create the CRUD Request and show output |
| 43 | - $this->call('backpack:crud-request', ['name' => $nameTitle]); |
|
| 43 | + $this->call('backpack:crud-request', [ 'name' => $nameTitle ]); |
|
| 44 | 44 | |
| 45 | 45 | // Create the CRUD route |
| 46 | 46 | $this->call('backpack:add-custom-route', [ |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $kebabName = Str::kebab($this->argument('name')); |
| 33 | 33 | |
| 34 | 34 | // Create the ChartController and show output |
| 35 | - $this->call('backpack:chart-controller', ['name' => $studlyName]); |
|
| 35 | + $this->call('backpack:chart-controller', [ 'name' => $studlyName ]); |
|
| 36 | 36 | |
| 37 | 37 | // Create the chart route |
| 38 | 38 | $this->call('backpack:add-custom-route', [ |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
| 46 | 46 | |
| 47 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Request.php'; |
|
| 47 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'Request.php'; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -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).'ChartController.php'; |
|
| 48 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'ChartController.php'; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $name = str_replace($this->laravel->getNamespace(), '', $name); |
| 48 | 48 | |
| 49 | - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
| 49 | + return $this->laravel[ 'path' ].'/'.str_replace('\\', '/', $name).'CrudController.php'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | protected function getAttributes($model) |
| 96 | 96 | { |
| 97 | - $attributes = []; |
|
| 97 | + $attributes = [ ]; |
|
| 98 | 98 | $model = new $model; |
| 99 | 99 | |
| 100 | 100 | // if fillable was defined, use that as the attributes |
@@ -120,24 +120,24 @@ discard block |
||
| 120 | 120 | $class = Str::afterLast($name, '\\'); |
| 121 | 121 | $model = "App\\Models\\$class"; |
| 122 | 122 | |
| 123 | - if (! class_exists($model)) { |
|
| 123 | + if (!class_exists($model)) { |
|
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $attributes = $this->getAttributes($model); |
| 128 | 128 | |
| 129 | 129 | // create an array with the needed code for defining fields |
| 130 | - $fields = Arr::except($attributes, ['id', 'created_at', 'updated_at', 'deleted_at']); |
|
| 130 | + $fields = Arr::except($attributes, [ 'id', 'created_at', 'updated_at', 'deleted_at' ]); |
|
| 131 | 131 | $fields = collect($fields) |
| 132 | - ->map(function ($field) { |
|
| 132 | + ->map(function($field) { |
|
| 133 | 133 | return "CRUD::field('$field');"; |
| 134 | 134 | }) |
| 135 | 135 | ->toArray(); |
| 136 | 136 | |
| 137 | 137 | // create an array with the needed code for defining columns |
| 138 | - $columns = Arr::except($attributes, ['id']); |
|
| 138 | + $columns = Arr::except($attributes, [ 'id' ]); |
|
| 139 | 139 | $columns = collect($columns) |
| 140 | - ->map(function ($column) { |
|
| 140 | + ->map(function($column) { |
|
| 141 | 141 | return "CRUD::column('$column');"; |
| 142 | 142 | }) |
| 143 | 143 | ->toArray(); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | protected function replaceModel(&$stub, $name) |
| 160 | 160 | { |
| 161 | 161 | $class = str_replace($this->getNamespace($name).'\\', '', $name); |
| 162 | - $stub = str_replace(['DummyClass', '{{ class }}', '{{class}}'], $class, $stub); |
|
| 162 | + $stub = str_replace([ 'DummyClass', '{{ class }}', '{{class}}' ], $class, $stub); |
|
| 163 | 163 | |
| 164 | 164 | return $this; |
| 165 | 165 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | // make a list of all models |
| 33 | 33 | $models = $this->getModels(base_path().'/app'); |
| 34 | 34 | |
| 35 | - if (! count($models)) { |
|
| 35 | + if (!count($models)) { |
|
| 36 | 36 | $this->error('No models found.'); |
| 37 | 37 | |
| 38 | 38 | return false; |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | // Attach CrudTrait to Model |
| 45 | 45 | // Add sidebar item |
| 46 | 46 | // Add routes |
| 47 | - $this->call('backpack:crud', ['name' => $model]); |
|
| 47 | + $this->call('backpack:crud', [ 'name' => $model ]); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 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 | } |