@@ -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 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | |
| 59 | 59 | protected function initializeMorphable() |
| 60 | 60 | { |
| 61 | - if(!isset($this->morph_key)) { |
|
| 61 | + if (!isset($this->morph_key)) { |
|
| 62 | 62 | $this->morph_key = $this->morphKey(); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug. |
| 36 | 36 | if ($model instanceof Module) { |
| 37 | 37 | $model->update([ |
| 38 | - 'slug' => $model->slug . $this->deletionAppendix(), |
|
| 38 | + 'slug' => $model->slug.$this->deletionAppendix(), |
|
| 39 | 39 | ]); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -70,6 +70,6 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | private function deletionAppendix(): string |
| 72 | 72 | { |
| 73 | - return '_DELETED_' . time(); |
|
| 73 | + return '_DELETED_'.time(); |
|
| 74 | 74 | } |
| 75 | 75 | } |