@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | |
26 | 26 | public function manager(Manager $manager) |
27 | 27 | { |
28 | - $this->manager = $manager; |
|
28 | + $this->manager = $manager; |
|
29 | 29 | |
30 | - if (! $manager->model() instanceof ProvidesUrl) { |
|
31 | - throw new \Exception('UrlAssistant requires the model interfaced by ' . ProvidesUrl::class . '.'); |
|
30 | + if (!$manager->model() instanceof ProvidesUrl) { |
|
31 | + throw new \Exception('UrlAssistant requires the model interfaced by '.ProvidesUrl::class.'.'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $this->model = $manager->model(); |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | InputField::make('url-slugs') |
57 | 57 | ->validation( |
58 | 58 | [ |
59 | - 'url-slugs' => ['array', 'min:1', new UniqueUrlSlugRule(($this->model && $this->model->exists) ? $this->model : null),], |
|
59 | + 'url-slugs' => ['array', 'min:1', new UniqueUrlSlugRule(($this->model && $this->model->exists) ? $this->model : null), ], |
|
60 | 60 | ], |
61 | 61 | [], |
62 | 62 | [ |
63 | 63 | 'url-slugs.*' => 'taalspecifieke link', |
64 | 64 | ]) |
65 | 65 | ->view('chief::back._fields.url-slugs') |
66 | - ->viewData(['fields' => UrlSlugFields::fromModel($this->model) ]), |
|
66 | + ->viewData(['fields' => UrlSlugFields::fromModel($this->model)]), |
|
67 | 67 | ]); |
68 | 68 | } |
69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // TODO: we should just fetch the homepages and push that instead... |
76 | 76 | UrlRecord::getByModel($this->model)->reject(function($record) { |
77 | 77 | return ($record->isRedirect() || !$record->isHomepage()); |
78 | - })->each(function($record){ |
|
78 | + })->each(function($record) { |
|
79 | 79 | app(ChangeHomepage::class)->onUrlChanged($record); |
80 | 80 | }); |
81 | 81 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | // } |
29 | 29 | // } |
30 | 30 | |
31 | - foreach($flatReferences as $locale => $flatReferenceString) { |
|
31 | + foreach ($flatReferences as $locale => $flatReferenceString) { |
|
32 | 32 | |
33 | - if(!$flatReferenceString) { |
|
33 | + if (!$flatReferenceString) { |
|
34 | 34 | |
35 | 35 | // TODO: when empty we'll remove the entry, we'll also want to revert to last redirect. |
36 | 36 | |
37 | - if(isset($existingValues[$locale])) { |
|
37 | + if (isset($existingValues[$locale])) { |
|
38 | 38 | $flatReferenceInstance = FlatReferenceFactory::fromString(($existingValues[$locale])); |
39 | 39 | (new RevertUrlSlug($flatReferenceInstance->instance()))->handle($locale); |
40 | 40 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $model = Morphables::instance($urlRecord->model_type)->find($urlRecord->model_id); |
55 | 55 | |
56 | - if(!$homepage = Setting::findByKey(Setting::HOMEPAGE)){ |
|
56 | + if (!$homepage = Setting::findByKey(Setting::HOMEPAGE)) { |
|
57 | 57 | $homepage = Setting::create(['key' => Setting::HOMEPAGE, 'value' => []]); |
58 | 58 | } |
59 | 59 |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | { |
58 | 58 | $existingHomepageValue = []; |
59 | 59 | |
60 | - foreach($this->fields() as $key => $field) |
|
60 | + foreach ($this->fields() as $key => $field) |
|
61 | 61 | { |
62 | - if(!$setting = Setting::where('key', $key)->first()) { |
|
62 | + if (!$setting = Setting::where('key', $key)->first()) { |
|
63 | 63 | Setting::create([ |
64 | 64 | 'key' => $key, |
65 | 65 | 'value' => $request->get($key, ''), |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | |
71 | - if($key === Setting::HOMEPAGE) { |
|
71 | + if ($key === Setting::HOMEPAGE) { |
|
72 | 72 | $existingHomepageValue = $setting->value; |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | // A changed homepage needs to be reflected in the urls as well in order to respond to incoming requests. |
79 | - if($request->filled(Setting::HOMEPAGE)) { |
|
79 | + if ($request->filled(Setting::HOMEPAGE)) { |
|
80 | 80 | app(ChangeHomepage::class)->onSettingChanged($existingHomepageValue); |
81 | 81 | } |
82 | 82 | } |