@@ -67,7 +67,7 @@ |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | if (config('chief.strict')) { |
70 | - throw new NotFoundViewKey('Missing view key. Please add a [viewKey] property to ' . get_class($this)); |
|
70 | + throw new NotFoundViewKey('Missing view key. Please add a [viewKey] property to '.get_class($this)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return ''; |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | |
40 | 40 | // Set required paths |
41 | 41 | $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()]; |
42 | - $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] . '/' . config('chief.domain.path', 'src'); |
|
43 | - $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views'; |
|
44 | - $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'] . '/app/Http/Controllers'; |
|
45 | - $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'] . '/routes/web.php'; |
|
42 | + $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('chief.domain.path', 'src'); |
|
43 | + $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views'; |
|
44 | + $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'].'/app/Http/Controllers'; |
|
45 | + $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'].'/routes/web.php'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function handle() |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | private function publishModel() |
65 | 65 | { |
66 | 66 | $this->publishFile( |
67 | - __DIR__ . '/stubs/model.php.stub', |
|
68 | - $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
67 | + __DIR__.'/stubs/model.php.stub', |
|
68 | + $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
69 | 69 | 'model' |
70 | 70 | ); |
71 | 71 | |
72 | - $this->addToConfig('collections', [$this->plural => $this->guessNamespace() . '\\' . ucfirst($this->singular)]); |
|
72 | + $this->addToConfig('collections', [$this->plural => $this->guessNamespace().'\\'.ucfirst($this->singular)]); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | private function publishController() |
76 | 76 | { |
77 | 77 | $this->publishFile( |
78 | - __DIR__ . '/stubs/controller.php.stub', |
|
79 | - $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
78 | + __DIR__.'/stubs/controller.php.stub', |
|
79 | + $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
80 | 80 | 'controller' |
81 | 81 | ); |
82 | 82 | } |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | private function modelTraits() |
116 | 116 | { |
117 | 117 | return [ |
118 | - '\\' . Publishable::class, |
|
119 | - '\\' . Sortable::class, |
|
118 | + '\\'.Publishable::class, |
|
119 | + '\\'.Sortable::class, |
|
120 | 120 | 'q' => 'Proceed.', |
121 | 121 | ]; |
122 | 122 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | protected function publishFile($from, $to, $type) |
132 | 132 | { |
133 | 133 | if ($this->filesystem->exists($to) && !$this->option('force')) { |
134 | - if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) { |
|
134 | + if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) { |
|
135 | 135 | return; |
136 | 136 | } |
137 | 137 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $to = str_replace($this->dirs['base'], '', realpath($to)); |
172 | 172 | |
173 | - $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>'); |
|
173 | + $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | protected function replacePlaceholders($content) |
@@ -188,17 +188,17 @@ discard block |
||
188 | 188 | |
189 | 189 | private function generateImportStatements(): string |
190 | 190 | { |
191 | - return collect(['\\' . Page::class]) |
|
192 | - ->map(function ($statement) { |
|
193 | - return 'use ' . $statement . ";\n "; |
|
191 | + return collect(['\\'.Page::class]) |
|
192 | + ->map(function($statement) { |
|
193 | + return 'use '.$statement.";\n "; |
|
194 | 194 | })->implode(''); |
195 | 195 | } |
196 | 196 | |
197 | 197 | private function generateTraitStatements(): string |
198 | 198 | { |
199 | 199 | return collect($this->chosenTraits) |
200 | - ->map(function ($statement) { |
|
201 | - return 'use ' . $statement . ";\n "; |
|
200 | + ->map(function($statement) { |
|
201 | + return 'use '.$statement.";\n "; |
|
202 | 202 | })->implode(''); |
203 | 203 | } |
204 | 204 | |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | |
218 | 218 | // We make an estimated guess based on the project name. At Think Tomorrow, we |
219 | 219 | // have a src folder which is PSR-4 namespaced by the project name itself. |
220 | - return str_replace('\\\\', '\\', ucfirst(config('chief.domain.namespace', 'App')) . '\\' . ucfirst($this->plural)); |
|
220 | + return str_replace('\\\\', '\\', ucfirst(config('chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural)); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | private function addToConfig($configKey, $value) |
224 | 224 | { |
225 | - $current_values = config('chief.' . $configKey); |
|
225 | + $current_values = config('chief.'.$configKey); |
|
226 | 226 | |
227 | 227 | if (is_array($current_values)) { |
228 | 228 | $value = array_merge($current_values, $value); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | // Find value - note: this regex does not work for nested arrays! |
239 | 239 | // Also creates array with the non-short syntax. |
240 | - $content = preg_replace('/[\'|"]' . $key . '[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content); |
|
240 | + $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content); |
|
241 | 241 | |
242 | 242 | file_put_contents($file, $content); |
243 | 243 | } |