@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function apply($value = null): Closure |
21 | 21 | { |
22 | - return function ($query) use ($value) { |
|
22 | + return function($query) use ($value) { |
|
23 | 23 | if ($value == 'all') { |
24 | 24 | return $query; |
25 | 25 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->pageBuilderField(), |
89 | 89 | InputField::make('title')->translatable($this->model->availableLocales()) |
90 | 90 | ->validation('required-fallback-locale|max:200', [], [ |
91 | - 'trans.' . config('app.fallback_locale', 'nl') . '.title' => 'title', |
|
91 | + 'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title', |
|
92 | 92 | ]) |
93 | 93 | ->label('Intern label') |
94 | 94 | ->description('Dit is de benaming die zal worden getoond in de admin selectie velden.') |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if (is_array_empty($translation)) { |
211 | 211 | |
212 | 212 | // Nullify all values |
213 | - $trans[$locale] = array_map(function ($value) { |
|
213 | + $trans[$locale] = array_map(function($value) { |
|
214 | 214 | return null; |
215 | 215 | }, $translation); |
216 | 216 | continue; |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | // Set required paths |
39 | 39 | $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()]; |
40 | - $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] . '/' . config('thinktomorrow.chief.domain.path', 'src'); |
|
41 | - $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views'; |
|
42 | - $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'] . '/app/Http/Controllers'; |
|
43 | - $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'] . '/routes/web.php'; |
|
40 | + $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('thinktomorrow.chief.domain.path', 'src'); |
|
41 | + $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views'; |
|
42 | + $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'].'/app/Http/Controllers'; |
|
43 | + $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'].'/routes/web.php'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function handle() |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | private function publishModel() |
63 | 63 | { |
64 | 64 | $this->publishFile( |
65 | - __DIR__ . '/stubs/model.php.stub', |
|
66 | - $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
65 | + __DIR__.'/stubs/model.php.stub', |
|
66 | + $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
67 | 67 | 'model' |
68 | 68 | ); |
69 | 69 | |
70 | - $this->addToConfig('collections', [$this->plural => $this->guessNamespace() . '\\' . ucfirst($this->singular)]); |
|
70 | + $this->addToConfig('collections', [$this->plural => $this->guessNamespace().'\\'.ucfirst($this->singular)]); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | private function publishController() |
74 | 74 | { |
75 | 75 | $this->publishFile( |
76 | - __DIR__ . '/stubs/controller.php.stub', |
|
77 | - $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
76 | + __DIR__.'/stubs/controller.php.stub', |
|
77 | + $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
78 | 78 | 'controller' |
79 | 79 | ); |
80 | 80 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | private function modelTraits() |
114 | 114 | { |
115 | 115 | return [ |
116 | - '\\' . Publishable::class, |
|
117 | - '\\' . Sortable::class, |
|
116 | + '\\'.Publishable::class, |
|
117 | + '\\'.Sortable::class, |
|
118 | 118 | 'q' => 'Proceed.', |
119 | 119 | ]; |
120 | 120 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | protected function publishFile($from, $to, $type) |
130 | 130 | { |
131 | 131 | if ($this->filesystem->exists($to) && !$this->option('force')) { |
132 | - if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) { |
|
132 | + if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | $to = str_replace($this->dirs['base'], '', realpath($to)); |
170 | 170 | |
171 | - $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>'); |
|
171 | + $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | protected function replacePlaceholders($content) |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | |
187 | 187 | private function generateImportStatements(): string |
188 | 188 | { |
189 | - return collect(['\\' . Page::class]) |
|
190 | - ->map(function ($statement) { |
|
191 | - return 'use ' . $statement . ";\n "; |
|
189 | + return collect(['\\'.Page::class]) |
|
190 | + ->map(function($statement) { |
|
191 | + return 'use '.$statement.";\n "; |
|
192 | 192 | })->implode(''); |
193 | 193 | } |
194 | 194 | |
195 | 195 | private function generateTraitStatements(): string |
196 | 196 | { |
197 | 197 | return collect($this->chosenTraits) |
198 | - ->map(function ($statement) { |
|
199 | - return 'use ' . $statement . ";\n "; |
|
198 | + ->map(function($statement) { |
|
199 | + return 'use '.$statement.";\n "; |
|
200 | 200 | })->implode(''); |
201 | 201 | } |
202 | 202 | |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | |
216 | 216 | // We make an estimated guess based on the project name. At Think Tomorrow, we |
217 | 217 | // have a src folder which is PSR-4 namespaced by the project name itself. |
218 | - return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')) . '\\' . ucfirst($this->plural)); |
|
218 | + return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | private function addToConfig($configKey, $value) |
222 | 222 | { |
223 | - $current_values = config('thinktomorrow.chief.' . $configKey); |
|
223 | + $current_values = config('thinktomorrow.chief.'.$configKey); |
|
224 | 224 | |
225 | 225 | if (is_array($current_values)) { |
226 | 226 | $value = array_merge($current_values, $value); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | // Find value - note: this regex does not work for nested arrays! |
237 | 237 | // Also creates array with the non-short syntax. |
238 | - $content = preg_replace('/[\'|"]' . $key . '[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content); |
|
238 | + $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content); |
|
239 | 239 | |
240 | 240 | file_put_contents($file, $content); |
241 | 241 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | { |
29 | 29 | $managedRoutes = $this->expandWithAssistantRoutes($managerClass, $managedRoutes); |
30 | 30 | |
31 | - $this->router->group(['prefix' => $this->routePrefix, 'middleware' => $this->routeMiddleware], function () use($managedRoutes) { |
|
32 | - foreach($managedRoutes as $route) { |
|
31 | + $this->router->group(['prefix' => $this->routePrefix, 'middleware' => $this->routeMiddleware], function() use($managedRoutes) { |
|
32 | + foreach ($managedRoutes as $route) { |
|
33 | 33 | $this->router->addRoute( |
34 | 34 | $route->method, |
35 | - $managedRoutes->getName() .'/'. $route->uri, |
|
35 | + $managedRoutes->getName().'/'.$route->uri, |
|
36 | 36 | [$managedRoutes->getManagerClass(), Str::camel($route->action)] |
37 | - )->name('chief.' . $managedRoutes->getName() . '.' . $route->action); |
|
37 | + )->name('chief.'.$managedRoutes->getName().'.'.$route->action); |
|
38 | 38 | } |
39 | 39 | }); |
40 | 40 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - if(public_method_exists($managerClass, 'routes')) { |
|
51 | + if (public_method_exists($managerClass, 'routes')) { |
|
52 | 52 | $managedRoutes = $managedRoutes->push($managerClass::routes()); |
53 | 53 | } |
54 | 54 |
@@ -34,9 +34,9 @@ |
||
34 | 34 | $modules = $parent->children(); |
35 | 35 | |
36 | 36 | // Add their respective manager per class |
37 | - $moduleManagers = $modules->groupBy(function ($child) { |
|
37 | + $moduleManagers = $modules->groupBy(function($child) { |
|
38 | 38 | return get_class($child); |
39 | - })->map(function ($child, $class) { |
|
39 | + })->map(function($child, $class) { |
|
40 | 40 | return app(ModelToManagerMap::class)->find($class); |
41 | 41 | }); |
42 | 42 |