@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $this->fetch(); |
| 14 | 14 | |
| 15 | - if (! isset($this->values[$key])) { |
|
| 15 | + if (!isset($this->values[$key])) { |
|
| 16 | 16 | return $default; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public static function generate(): Field |
| 12 | 12 | { |
| 13 | 13 | $singles = Single::all(); |
| 14 | - $singles = $singles->map(function ($single) { |
|
| 14 | + $singles = $singles->map(function($single) { |
|
| 15 | 15 | |
| 16 | 16 | // Select label (from translatable title field) |
| 17 | 17 | $single->label = $single->title; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function register() |
| 15 | 15 | { |
| 16 | - $this->app->singleton(SettingsManager::class, function ($app) { |
|
| 16 | + $this->app->singleton(SettingsManager::class, function($app) { |
|
| 17 | 17 | return new SettingsManager(); |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | private function defaultField() |
| 46 | 46 | { |
| 47 | 47 | return InputField::make($this->key) |
| 48 | - ->label(ucfirst(str_replace(['-','_','.'], ' ', $this->key))); |
|
| 48 | + ->label(ucfirst(str_replace(['-', '_', '.'], ' ', $this->key))); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public static function refreshFieldsFromConfig() |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public static function toSelectValues(Collection $collection): Collection |
| 10 | 10 | { |
| 11 | - return $collection->map(function (ProvidesFlatReference $item) { |
|
| 11 | + return $collection->map(function(ProvidesFlatReference $item) { |
|
| 12 | 12 | return [ |
| 13 | 13 | 'id' => $item->flatReference()->get(), |
| 14 | 14 | 'label' => $item->flatReferenceLabel(), |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $grouped = []; |
| 23 | 23 | |
| 24 | - static::toSelectValues($collection)->each(function ($item) use (&$grouped) { |
|
| 24 | + static::toSelectValues($collection)->each(function($item) use (&$grouped) { |
|
| 25 | 25 | if (isset($grouped[$item['group']])) { |
| 26 | 26 | $grouped[$item['group']]['values'][] = $item; |
| 27 | - } else { |
|
| 27 | + }else { |
|
| 28 | 28 | $grouped[$item['group']] = ['group' => $item['group'], 'values' => [$item]]; |
| 29 | 29 | } |
| 30 | 30 | }); |
@@ -21,16 +21,16 @@ |
||
| 21 | 21 | $referenceStrings = []; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - return (new Collection($referenceStrings))->reject(function ($referenceString) { |
|
| 24 | + return (new Collection($referenceStrings))->reject(function($referenceString) { |
|
| 25 | 25 | return is_null($referenceString); |
| 26 | - })->map(function ($referenceString) { |
|
| 26 | + })->map(function($referenceString) { |
|
| 27 | 27 | return FlatReferenceFactory::fromString($referenceString)->instance(); |
| 28 | 28 | }); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function toFlatReferences(): Collection |
| 32 | 32 | { |
| 33 | - return (new Collection($this->all()))->map(function (ProvidesFlatReference $item) { |
|
| 33 | + return (new Collection($this->all()))->map(function(ProvidesFlatReference $item) { |
|
| 34 | 34 | return $item->flatReference()->get(); |
| 35 | 35 | }); |
| 36 | 36 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | public static function fromString(string $reference): FlatReference |
| 8 | 8 | { |
| 9 | 9 | if (false == strpos($reference, '@')) { |
| 10 | - throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. [' . $reference . '] was passed instead.'); |
|
| 10 | + throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. ['.$reference.'] was passed instead.'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | list($className, $id) = explode('@', $reference); |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | $instance = app($className); |
| 16 | 16 | $instance->{$instance->getKeyName()} = $id; |
| 17 | 17 | |
| 18 | - if (! method_exists($instance, 'flatReference')) { |
|
| 19 | - throw new \InvalidArgumentException('Instance created from model reference [' . $reference . '] was expected to have a method of flatReference() but is has not.'); |
|
| 18 | + if (!method_exists($instance, 'flatReference')) { |
|
| 19 | + throw new \InvalidArgumentException('Instance created from model reference ['.$reference.'] was expected to have a method of flatReference() but is has not.'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | return $instance->flatReference(); |
@@ -90,11 +90,11 @@ |
||
| 90 | 90 | return new Fields([ |
| 91 | 91 | $this->pageBuilderField(), |
| 92 | 92 | InputField::make('title')->translatable($this->model->availableLocales()) |
| 93 | - ->validation('required-fallback-locale|max:200', [], [ |
|
| 94 | - 'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title', |
|
| 95 | - ]) |
|
| 96 | - ->label('De titel van je '.$this->model->labelSingular ?? 'pagina') |
|
| 97 | - ->description('Dit is de titel die zal worden getoond in de overzichten en modules.<br> Deze zal gebruikt worden als interne titel en slug van de nieuwe pagina.'), |
|
| 93 | + ->validation('required-fallback-locale|max:200', [], [ |
|
| 94 | + 'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title', |
|
| 95 | + ]) |
|
| 96 | + ->label('De titel van je '.$this->model->labelSingular ?? 'pagina') |
|
| 97 | + ->description('Dit is de titel die zal worden getoond in de overzichten en modules.<br> Deze zal gebruikt worden als interne titel en slug van de nieuwe pagina.'), |
|
| 98 | 98 | InputField::make('slug') |
| 99 | 99 | ->translatable($this->model->availableLocales()) |
| 100 | 100 | ->validation($this->model->id |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | parent::__construct($registration); |
| 41 | 41 | |
| 42 | - $this->uniqueSlug = UniqueSlug::make(new PageTranslation)->slugResolver(function ($value) { |
|
| 42 | + $this->uniqueSlug = UniqueSlug::make(new PageTranslation)->slugResolver(function($value) { |
|
| 43 | 43 | return str_slug_slashed($value); |
| 44 | 44 | }); |
| 45 | 45 | } |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $permission = 'update-page'; |
| 65 | 65 | |
| 66 | - if (in_array($verb, ['index','show'])) { |
|
| 66 | + if (in_array($verb, ['index', 'show'])) { |
|
| 67 | 67 | $permission = 'view-page'; |
| 68 | - } elseif (in_array($verb, ['create','store'])) { |
|
| 68 | + } elseif (in_array($verb, ['create', 'store'])) { |
|
| 69 | 69 | $permission = 'create-page'; |
| 70 | 70 | } elseif (in_array($verb, ['delete'])) { |
| 71 | 71 | $permission = 'delete-page'; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
| 74 | + if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
| 75 | 75 | throw NotAllowedManagerRoute::notAllowedPermission($permission, $this); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | InputField::make('slug') |
| 99 | 99 | ->translatable($this->model->availableLocales()) |
| 100 | 100 | ->validation($this->model->id |
| 101 | - ? 'required-fallback-locale|unique:page_translations,slug,' . $this->model->id . ',page_id' |
|
| 101 | + ? 'required-fallback-locale|unique:page_translations,slug,'.$this->model->id.',page_id' |
|
| 102 | 102 | : 'required-fallback-locale|unique:page_translations,slug', [], [ |
| 103 | 103 | 'trans.'.config('app.fallback_locale', 'nl').'.slug' => 'slug' |
| 104 | 104 | ]) |
| 105 | 105 | ->label('Link') |
| 106 | 106 | ->description('De unieke url verwijzing naar deze pagina.') |
| 107 | - ->prepend(collect($this->model->availableLocales())->mapWithKeys(function ($locale) { |
|
| 107 | + ->prepend(collect($this->model->availableLocales())->mapWithKeys(function($locale) { |
|
| 108 | 108 | return [$locale => url($this->model->baseUrlSegment($locale)).'/']; |
| 109 | 109 | })->all()), |
| 110 | 110 | InputField::make('seo_title') |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function fieldArrangement($key = null): FieldArrangement |
| 141 | 141 | { |
| 142 | 142 | if ($key == 'create') { |
| 143 | - return new FieldArrangement($this->fields()->filterBy(function ($field) { |
|
| 143 | + return new FieldArrangement($this->fields()->filterBy(function($field) { |
|
| 144 | 144 | return $field->key == 'title'; |
| 145 | 145 | })); |
| 146 | 146 | } |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | if ($this->model->id) { |
| 160 | 160 | return parent::details() |
| 161 | 161 | ->set('title', $this->model->title) |
| 162 | - ->set('intro', 'laatst aangepast op ' . $this->model->updated_at->format('d/m/Y H:i')) |
|
| 163 | - ->set('context', '<span class="inline-s">' . $this->assistant('publish')->publicationStatusAsLabel() . '</span>'); |
|
| 162 | + ->set('intro', 'laatst aangepast op '.$this->model->updated_at->format('d/m/Y H:i')) |
|
| 163 | + ->set('context', '<span class="inline-s">'.$this->assistant('publish')->publicationStatusAsLabel().'</span>'); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return parent::details(); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | public function saveFields(): Manager |
| 170 | 170 | { |
| 171 | 171 | // Store the morph_key upon creation |
| 172 | - if (! $this->model->morph_key) { |
|
| 172 | + if (!$this->model->morph_key) { |
|
| 173 | 173 | $this->model->morph_key = $this->model->morphKey(); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if (is_array_empty($translation)) { |
| 209 | 209 | |
| 210 | 210 | // Nullify all values |
| 211 | - $trans[$locale] = array_map(function ($value) { |
|
| 211 | + $trans[$locale] = array_map(function($value) { |
|
| 212 | 212 | return null; |
| 213 | 213 | }, $translation); |
| 214 | 214 | continue; |
@@ -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 | } |