@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class FilterType |
8 | 8 | { |
9 | - const HIDDEN = 'hidden'; // hidden input - default sorting or filtering without admin manipulation possible |
|
10 | - const INPUT = 'input'; // oneliner text (input) |
|
11 | - const SELECT = 'select'; // Select options |
|
9 | + const HIDDEN = 'hidden'; // hidden input - default sorting or filtering without admin manipulation possible |
|
10 | + const INPUT = 'input'; // oneliner text (input) |
|
11 | + const SELECT = 'select'; // Select options |
|
12 | 12 | const CHECKBOX = 'checkbox'; |
13 | 13 | const RADIO = 'radio'; |
14 | 14 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | |
81 | 81 | public function render(): string |
82 | 82 | { |
83 | - $path = $this->view ?? 'chief::back._filters.' . $this->type; |
|
83 | + $path = $this->view ?? 'chief::back._filters.'.$this->type; |
|
84 | 84 | |
85 | 85 | return view($path, $this->viewData())->render(); |
86 | 86 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | |
35 | 35 | public function render(): string |
36 | 36 | { |
37 | - return array_reduce($this->all(), function ($carry, Filter $filter) { |
|
38 | - return $carry . $filter->render(); |
|
37 | + return array_reduce($this->all(), function($carry, Filter $filter) { |
|
38 | + return $carry.$filter->render(); |
|
39 | 39 | }, ''); |
40 | 40 | } |
41 | 41 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | public function anyRenderable(): bool |
48 | 48 | { |
49 | - if($this->isEmpty()) return false; |
|
49 | + if ($this->isEmpty()) return false; |
|
50 | 50 | |
51 | 51 | // If at least one of the filters has content to be rendered. |
52 | - foreach($this->filters as $filter) { |
|
53 | - if($filter->render()) { |
|
52 | + foreach ($this->filters as $filter) { |
|
53 | + if ($filter->render()) { |
|
54 | 54 | return true; |
55 | 55 | } |
56 | 56 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | |
66 | 66 | public function keys(): array |
67 | 67 | { |
68 | - return array_map(function (AbstractFilter $filter) { |
|
68 | + return array_map(function(AbstractFilter $filter) { |
|
69 | 69 | return $filter->key(); |
70 | 70 | }, $this->filters); |
71 | 71 | } |
72 | 72 | |
73 | 73 | private function validateFilters(array $filters) |
74 | 74 | { |
75 | - array_map(function (Filter $filter) {}, $filters); |
|
75 | + array_map(function(Filter $filter) {}, $filters); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | public function add(Filter ...$filter) |
@@ -46,7 +46,9 @@ |
||
46 | 46 | |
47 | 47 | public function anyRenderable(): bool |
48 | 48 | { |
49 | - if($this->isEmpty()) return false; |
|
49 | + if($this->isEmpty()) { |
|
50 | + return false; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | // If at least one of the filters has content to be rendered. |
52 | 54 | foreach($this->filters as $filter) { |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | $modelPath = (new \ReflectionClass(static::class))->getFileName(); |
35 | 35 | |
36 | 36 | $states = [ |
37 | - 'cache-file-found-and-up-to-date' => function () use ($cachePath) { |
|
37 | + 'cache-file-found-and-up-to-date' => function() use ($cachePath) { |
|
38 | 38 | static::setSqliteConnection($cachePath); |
39 | 39 | }, |
40 | - 'cache-file-not-found-or-stale' => function () use ($cachePath, $modelPath, $instance) { |
|
40 | + 'cache-file-not-found-or-stale' => function() use ($cachePath, $modelPath, $instance) { |
|
41 | 41 | file_put_contents($cachePath, ''); |
42 | 42 | |
43 | 43 | static::setSqliteConnection($cachePath); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | touch($cachePath, filemtime($modelPath)); |
48 | 48 | }, |
49 | - 'no-caching-capabilities' => function () use ($instance) { |
|
49 | + 'no-caching-capabilities' => function() use ($instance) { |
|
50 | 50 | static::setSqliteConnection(':memory:'); |
51 | 51 | |
52 | 52 | $instance->migrate(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ]; |
55 | 55 | |
56 | 56 | switch (true) { |
57 | - case ! property_exists($instance, 'rows'): |
|
57 | + case !property_exists($instance, 'rows'): |
|
58 | 58 | $states['no-caching-capabilities'](); |
59 | 59 | break; |
60 | 60 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $firstRow = $rows[0]; |
87 | 87 | $tableName = $this->getTable(); |
88 | 88 | |
89 | - static::resolveConnection()->getSchemaBuilder()->create($tableName, function ($table) use ($firstRow) { |
|
89 | + static::resolveConnection()->getSchemaBuilder()->create($tableName, function($table) use ($firstRow) { |
|
90 | 90 | // Add the "id" column if it doesn't already exist in the rows. |
91 | - if ($this->incrementing && ! in_array($this->primaryKey, array_keys($firstRow))) { |
|
91 | + if ($this->incrementing && !in_array($this->primaryKey, array_keys($firstRow))) { |
|
92 | 92 | $table->increments($this->primaryKey); |
93 | 93 | } |
94 | 94 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $table->{$type}($column)->nullable(); |
123 | 123 | } |
124 | 124 | |
125 | - if ($this->usesTimestamps() && (! in_array('updated_at', array_keys($firstRow)) || ! in_array('created_at', array_keys($firstRow)))) { |
|
125 | + if ($this->usesTimestamps() && (!in_array('updated_at', array_keys($firstRow)) || !in_array('created_at', array_keys($firstRow)))) { |
|
126 | 126 | $table->timestamps(); |
127 | 127 | } |
128 | 128 | }); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $parameters = array_merge((array)$modelId, $parameters); |
64 | 64 | } |
65 | 65 | |
66 | - return route('chief.' . self::managerKey() . '.' . $action, $parameters); |
|
66 | + return route('chief.'.self::managerKey().'.'.$action, $parameters); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function can(string $action): bool |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $model->saveFields($model->fields(), $request); |
151 | 151 | |
152 | 152 | return redirect()->to($this->route('edit', $model)) |
153 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is toegevoegd'); |
|
153 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is toegevoegd'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function edit($id) |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function boot() |
14 | 14 | { |
15 | 15 | // Make one global managedRoutes collection |
16 | - foreach([ |
|
16 | + foreach ([ |
|
17 | 17 | // CatalogPageManager::class => ['model' => CatalogPageModel::class], |
18 | 18 | BlogpostManager::class, |
19 | 19 | FakieManager::class, |
@@ -44,13 +44,13 @@ |
||
44 | 44 | { |
45 | 45 | return [ |
46 | 46 | 'title' => $this->title, |
47 | - 'subtitle' => 'awesome subtitle id: ' . $this->id, |
|
47 | + 'subtitle' => 'awesome subtitle id: '.$this->id, |
|
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | |
51 | 51 | public function adminLabel(string $key, array $replace = [], $default = null): ?string |
52 | 52 | { |
53 | - if(!array_key_exists($key, $this->adminLabels())) { |
|
53 | + if (!array_key_exists($key, $this->adminLabels())) { |
|
54 | 54 | return $default; |
55 | 55 | } |
56 | 56 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function fields(): Fields |
34 | 34 | { |
35 | 35 | return new Fields([ |
36 | - TextField::make('content')->locales(['nl','en']), |
|
36 | + TextField::make('content')->locales(['nl', 'en']), |
|
37 | 37 | InputField::make('title'), |
38 | 38 | ]); |
39 | 39 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function adminLabel(string $key, array $replace = [], $default = null): ?string |
62 | 62 | { |
63 | - if(!array_key_exists($key, $this->adminLabels())) { |
|
63 | + if (!array_key_exists($key, $this->adminLabels())) { |
|
64 | 64 | return $default; |
65 | 65 | } |
66 | 66 |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function route(string $action, $model = null, ...$parameters): string |
59 | 59 | { |
60 | - foreach(DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) { |
|
61 | - if(null !== ($route = $this->$method($action, $model, ...$parameters))){ |
|
60 | + foreach (DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) { |
|
61 | + if (null !== ($route = $this->$method($action, $model, ...$parameters))) { |
|
62 | 62 | return $route; |
63 | 63 | } |
64 | 64 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | public function can($action, $model = null): bool |
70 | 70 | { |
71 | - foreach(DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) { |
|
72 | - if(true === $this->$method($action, $model)){ |
|
71 | + foreach (DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) { |
|
72 | + if (true === $this->$method($action, $model)) { |
|
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | } |