@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | protected function getStub() |
115 | 115 | { |
116 | 116 | if ($this->option('pivot')) { |
117 | - return config('fastApi.stubs_dir').'/pivot.model.stub'; |
|
117 | + return config('fastApi.stubs_dir') . '/pivot.model.stub'; |
|
118 | 118 | } |
119 | 119 | |
120 | - return config('fastApi.stubs_dir').'/model.stub'; |
|
120 | + return config('fastApi.stubs_dir') . '/model.stub'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | 'Generate a migration, factory, and resource controller for the model', |
148 | 148 | ], |
149 | 149 | |
150 | - ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'], |
|
150 | + [ 'controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model' ], |
|
151 | 151 | |
152 | - ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'], |
|
152 | + [ 'factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model' ], |
|
153 | 153 | |
154 | - ['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists.'], |
|
154 | + [ 'force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists.' ], |
|
155 | 155 | |
156 | - ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'], |
|
156 | + [ 'migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.' ], |
|
157 | 157 | |
158 | 158 | [ |
159 | 159 | 'pivot', |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function buildClass($name) |
47 | 47 | { |
48 | - $replace = []; |
|
48 | + $replace = [ ]; |
|
49 | 49 | if ($model = $this->option('model')) { |
50 | 50 | $model = Str::studly(class_basename($this->option('model'))); |
51 | 51 | $slug = Str::slug(str_to_words($model), '_'); |
52 | - $replace['$modelSlug$'] = $slug; |
|
53 | - $replace['$modelTable$'] = Str::plural($slug, 2); |
|
52 | + $replace[ '$modelSlug$' ] = $slug; |
|
53 | + $replace[ '$modelTable$' ] = Str::plural($slug, 2); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return str_replace( |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | protected function getOptions() |
79 | 79 | { |
80 | 80 | return [ |
81 | - ['model', 'm', InputOption::VALUE_REQUIRED, 'The given model.'], |
|
82 | - ['type', 't', InputOption::VALUE_OPTIONAL, 'Type of request. Values can be store or update'], |
|
81 | + [ 'model', 'm', InputOption::VALUE_REQUIRED, 'The given model.' ], |
|
82 | + [ 'type', 't', InputOption::VALUE_OPTIONAL, 'Type of request. Values can be store or update' ], |
|
83 | 83 | ]; |
84 | 84 | } |
85 | 85 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function getStub() |
37 | 37 | { |
38 | - return config('fastApi.stubs_dir').'/factory.stub'; |
|
38 | + return config('fastApi.stubs_dir') . '/factory.stub'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | protected function getPath($name) |
67 | 67 | { |
68 | 68 | $name = str_replace( |
69 | - ['\\', '/'], '', $this->argument('name') |
|
69 | + [ '\\', '/' ], '', $this->argument('name') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | return $this->laravel->databasePath() . "/factories/{$name}.php"; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | protected function getOptions() |
81 | 81 | { |
82 | 82 | return [ |
83 | - ['model', 'm', InputOption::VALUE_OPTIONAL, 'The name of the model'], |
|
83 | + [ 'model', 'm', InputOption::VALUE_OPTIONAL, 'The name of the model' ], |
|
84 | 84 | ]; |
85 | 85 | } |
86 | 86 | } |
@@ -131,12 +131,12 @@ |
||
131 | 131 | |
132 | 132 | $viewsDir = $this->option('views-dir'); |
133 | 133 | if ($viewsDir) { |
134 | - $args['--views-dir'] = $viewsDir; |
|
134 | + $args[ '--views-dir' ] = $viewsDir; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $controllerDir = $this->option('controller-dir'); |
138 | 138 | if ($controllerDir) { |
139 | - $args['--controller-dir'] = $controllerDir; |
|
139 | + $args[ '--controller-dir' ] = $controllerDir; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $this->call('fastApi:controller', $args); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $controllerNamespace = $this->getNamespace($name); |
76 | 76 | |
77 | - $replace = []; |
|
77 | + $replace = [ ]; |
|
78 | 78 | |
79 | 79 | if ($this->option('parent')) { |
80 | 80 | $replace = $this->buildParentReplacements(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - $replace["use {$controllerNamespace}\Controller;\n"] = ''; |
|
91 | + $replace[ "use {$controllerNamespace}\Controller;\n" ] = ''; |
|
92 | 92 | |
93 | 93 | return str_replace( |
94 | 94 | array_keys($replace), array_values($replace), parent::buildClass($name) |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | if (!class_exists($parentModelClass)) { |
108 | 108 | if ($this->confirm("A {$parentModelClass} model does not exist. Do you want to generate it?", true)) { |
109 | - $this->call('fastApi:model', ['name' => $parentModelClass]); |
|
109 | + $this->call('fastApi:model', [ 'name' => $parentModelClass ]); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | if (!class_exists($modelClass)) { |
154 | 154 | |
155 | - $this->call('fastApi:model', ['name' => $modelClass]); |
|
155 | + $this->call('fastApi:model', [ 'name' => $modelClass ]); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | $label = str_to_words(class_basename($modelClass)); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | private function appendModelToViewDir($path, $model) |
182 | 182 | { |
183 | 183 | $pathArray = explode("/", $path); |
184 | - if ($pathArray[sizeof($pathArray) - 1] == $model) { |
|
184 | + if ($pathArray[ sizeof($pathArray) - 1 ] == $model) { |
|
185 | 185 | return $path; |
186 | 186 | } |
187 | 187 | |
@@ -196,21 +196,21 @@ discard block |
||
196 | 196 | protected function getOptions() |
197 | 197 | { |
198 | 198 | return [ |
199 | - ['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.'], |
|
199 | + [ 'model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.' ], |
|
200 | 200 | |
201 | - ['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.'], |
|
201 | + [ 'resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.' ], |
|
202 | 202 | |
203 | - ['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'], |
|
203 | + [ 'parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.' ], |
|
204 | 204 | |
205 | - ['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.'], |
|
205 | + [ 'api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.' ], |
|
206 | 206 | |
207 | - ['views-dir', 'i', InputOption::VALUE_OPTIONAL, 'Use the specified path in controller actions to return the respective view'], |
|
207 | + [ 'views-dir', 'i', InputOption::VALUE_OPTIONAL, 'Use the specified path in controller actions to return the respective view' ], |
|
208 | 208 | |
209 | - ['controller-dir', 'c', InputOption::VALUE_OPTIONAL, 'Specify the controller path within the Http directory'], |
|
209 | + [ 'controller-dir', 'c', InputOption::VALUE_OPTIONAL, 'Specify the controller path within the Http directory' ], |
|
210 | 210 | |
211 | - ['route-base', 'b', InputOption::VALUE_OPTIONAL, 'Specify the base route to use'], |
|
211 | + [ 'route-base', 'b', InputOption::VALUE_OPTIONAL, 'Specify the base route to use' ], |
|
212 | 212 | |
213 | - ['force', 'f', InputOption::VALUE_NONE, 'Overwrite existing controller'] |
|
213 | + [ 'force', 'f', InputOption::VALUE_NONE, 'Overwrite existing controller' ] |
|
214 | 214 | ]; |
215 | 215 | } |
216 | 216 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | // If no table was given as an option but a create option is given then we |
77 | 77 | // will use the "create" option as the table name. This allows the devs |
78 | 78 | // to pass a table name into this option as a short-cut for creating. |
79 | - if (! $table && is_string($create)) { |
|
79 | + if (!$table && is_string($create)) { |
|
80 | 80 | $table = $create; |
81 | 81 | |
82 | 82 | $create = true; |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | // Next, we will attempt to guess the table name if this the migration has |
86 | 86 | // "create" in the name. This will allow us to provide a convenient way |
87 | 87 | // of creating migrations that create new tables for the application. |
88 | - if (! $table) { |
|
89 | - [$table, $create] = TableGuesser::guess($name); |
|
88 | + if (!$table) { |
|
89 | + [ $table, $create ] = TableGuesser::guess($name); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // Now we are ready to write the migration out to disk. Once we've written |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $name, $this->getMigrationPath(), $table, $create |
112 | 112 | ); |
113 | 113 | |
114 | - if (! $this->option('fullpath')) { |
|
114 | + if (!$this->option('fullpath')) { |
|
115 | 115 | $file = pathinfo($file, PATHINFO_FILENAME); |
116 | 116 | } |
117 | 117 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function getMigrationPath() |
127 | 127 | { |
128 | - if (! is_null($targetPath = $this->input->getOption('path'))) { |
|
129 | - return ! $this->usingRealPath() |
|
130 | - ? $this->laravel->basePath().'/'.$targetPath |
|
128 | + if (!is_null($targetPath = $this->input->getOption('path'))) { |
|
129 | + return !$this->usingRealPath() |
|
130 | + ? $this->laravel->basePath() . '/' . $targetPath |
|
131 | 131 | : $targetPath; |
132 | 132 | } |
133 | 133 |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | |
42 | 42 | protected function buildClass($name) |
43 | 43 | { |
44 | - $replace = []; |
|
44 | + $replace = [ ]; |
|
45 | 45 | if ($model = $this->option('model')) { |
46 | 46 | $model = Str::studly(class_basename($this->option('model'))); |
47 | 47 | $slug = Str::slug(str_to_words($model), '_'); |
48 | - $replace['$modelSlug$'] = $slug; |
|
49 | - $replace['$modelTable$'] = Str::plural($slug, 2); |
|
48 | + $replace[ '$modelSlug$' ] = $slug; |
|
49 | + $replace[ '$modelTable$' ] = Str::plural($slug, 2); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return str_replace( |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | protected function getOptions() |
75 | 75 | { |
76 | 76 | return [ |
77 | - ['model', 'm', InputOption::VALUE_REQUIRED, 'The given model.'], |
|
78 | - ['type', 't', InputOption::VALUE_OPTIONAL, 'Type of resource. Values can be store or update'], |
|
77 | + [ 'model', 'm', InputOption::VALUE_REQUIRED, 'The given model.' ], |
|
78 | + [ 'type', 't', InputOption::VALUE_OPTIONAL, 'Type of resource. Values can be store or update' ], |
|
79 | 79 | ]; |
80 | 80 | } |
81 | 81 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | $name = Str::replaceFirst($this->rootNamespace(), '', $name); |
130 | 130 | |
131 | - return $this->laravel['path'] . '/' . str_replace('\\', '/', $name) . '.php'; |
|
131 | + return $this->laravel[ 'path' ] . '/' . str_replace('\\', '/', $name) . '.php'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | $namespace = $this->getNamespace($name); |
217 | 217 | |
218 | 218 | $stub = str_replace( |
219 | - ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'], |
|
220 | - [$namespace, $this->rootNamespace(), config('auth.providers.users.model')], |
|
219 | + [ 'DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel' ], |
|
220 | + [ $namespace, $this->rootNamespace(), config('auth.providers.users.model') ], |
|
221 | 221 | $stub |
222 | 222 | ); |
223 | 223 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | protected function getArguments() |
233 | 233 | { |
234 | 234 | return [ |
235 | - ['name', InputArgument::REQUIRED, 'The name of the class'], |
|
235 | + [ 'name', InputArgument::REQUIRED, 'The name of the class' ], |
|
236 | 236 | ]; |
237 | 237 | } |
238 | 238 |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | return [ |
3 | - "stubs_dir" => base_path('vendor/larafast/fastapi/resources/stubs'), |
|
3 | + "stubs_dir" => base_path('vendor/larafast/fastapi/resources/stubs'), |
|
4 | 4 | ]; |