@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function findAllArchived(): Collection |
52 | 52 | { |
53 | - return $this->manager->modelInstance()::archived()->get()->map(function ($model) { |
|
53 | + return $this->manager->modelInstance()::archived()->get()->map(function($model) { |
|
54 | 54 | return $this->managers->findByModel($model); |
55 | 55 | }); |
56 | 56 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function route($verb): ?string |
59 | 59 | { |
60 | 60 | $routes = [ |
61 | - 'index' => route('chief.back.assistants.view', [$this->key(),'index', $this->manager->managerKey()]), |
|
61 | + 'index' => route('chief.back.assistants.view', [$this->key(), 'index', $this->manager->managerKey()]), |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | if (array_key_exists($verb, $routes)) { |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | |
81 | 81 | private function guard($verb): Assistant |
82 | 82 | { |
83 | - if(!$this->manager->existingModel() instanceof StatefulContract){ |
|
83 | + if (!$this->manager->existingModel() instanceof StatefulContract) { |
|
84 | 84 | throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract. ['.get_class($this->model).'] given instead.'); |
85 | 85 | } |
86 | 86 | |
87 | - if (! $this->can($verb)) { |
|
87 | + if (!$this->can($verb)) { |
|
88 | 88 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
89 | 89 | } |
90 | 90 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | // Ok now get all urls from this model and point them to the new records |
113 | 113 | foreach (UrlRecord::getByModel($this->manager->existingModel()) as $urlRecord) { |
114 | - if ($targetRecord = $targetRecords->first(function ($record) use ($urlRecord) { |
|
114 | + if ($targetRecord = $targetRecords->first(function($record) use ($urlRecord) { |
|
115 | 115 | return ($record->locale == $urlRecord->locale && !$record->isRedirect()); |
116 | 116 | })) { |
117 | 117 | $urlRecord->redirectTo($targetRecord); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | app(ArchiveManagedModel::class)->handle($this->manager->existingModel()); |
123 | 123 | |
124 | - return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is gearchiveerd.'); |
|
124 | + return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is gearchiveerd.'); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | public function unarchive() |
@@ -130,6 +130,6 @@ discard block |
||
130 | 130 | |
131 | 131 | app(UnArchiveManagedModel::class)->handle($this->manager->existingModel()); |
132 | 132 | |
133 | - return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is hersteld.'); |
|
133 | + return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is hersteld.'); |
|
134 | 134 | } |
135 | 135 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'url-slugs.*' => 'taalspecifieke link', |
54 | 54 | ]) |
55 | 55 | ->view('chief::back._fields.url-slugs') |
56 | - ->viewData(['fields' => UrlSlugFields::fromModel($this->manager->modelInstance()) ]), |
|
56 | + ->viewData(['fields' => UrlSlugFields::fromModel($this->manager->modelInstance())]), |
|
57 | 57 | ]); |
58 | 58 | } |
59 | 59 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | |
64 | 64 | // Push update to homepage setting value |
65 | 65 | // TODO: we should just fetch the homepages and push that instead... |
66 | - UrlRecord::getByModel($this->manager->existingModel())->reject(function ($record) { |
|
66 | + UrlRecord::getByModel($this->manager->existingModel())->reject(function($record) { |
|
67 | 67 | return ($record->isRedirect() || !$record->isHomepage()); |
68 | - })->each(function ($record) { |
|
68 | + })->each(function($record) { |
|
69 | 69 | app(ChangeHomepage::class)->onUrlChanged($record); |
70 | 70 | }); |
71 | 71 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | |
78 | 78 | private function validateModel() |
79 | 79 | { |
80 | - if (! $this->manager->existingModel() instanceof ProvidesUrl) { |
|
81 | - throw new \Exception('UrlAssistant requires the model interfaced by ' . ProvidesUrl::class . '.'); |
|
80 | + if (!$this->manager->existingModel() instanceof ProvidesUrl) { |
|
81 | + throw new \Exception('UrlAssistant requires the model interfaced by '.ProvidesUrl::class.'.'); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | app(PublishManagedModel::class)->handle($this->manager->existingModel()); |
57 | 57 | |
58 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title .' is online gezet.'); |
|
58 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is online gezet.'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function unpublish() |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | |
65 | 65 | app(UnpublishManagedModel::class)->handle($this->manager->existingModel()); |
66 | 66 | |
67 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title .' is offline gehaald.'); |
|
67 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is offline gehaald.'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function findAll(): Collection |
71 | 71 | { |
72 | - return $this->manager->existingModel()->published()->get()->map(function ($model) { |
|
72 | + return $this->manager->existingModel()->published()->get()->map(function($model) { |
|
73 | 73 | return $this->managers->findByModel($model); |
74 | 74 | }); |
75 | 75 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | private function guard($verb): Assistant |
93 | 93 | { |
94 | - if (! $this->can($verb)) { |
|
94 | + if (!$this->can($verb)) { |
|
95 | 95 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
96 | 96 | } |
97 | 97 | |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | $class = 'text-warning'; |
117 | 117 | } |
118 | 118 | |
119 | - $statusAsLabel = '<span class="font-bold '. $class .'"><em>' . $label . '</em></span>'; |
|
119 | + $statusAsLabel = '<span class="font-bold '.$class.'"><em>'.$label.'</em></span>'; |
|
120 | 120 | |
121 | 121 | if (!$plain && $this->hasPreviewUrl()) { |
122 | - $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>'; |
|
122 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $statusAsLabel; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $genericModelInstance = $this->modelInstance(); |
17 | 17 | |
18 | 18 | // Generic model details |
19 | - $id = Str::slug($this->registration->key(). ($this->hasExistingModel() ? '-'. $this->existingModel()->id : '')); |
|
19 | + $id = Str::slug($this->registration->key().($this->hasExistingModel() ? '-'.$this->existingModel()->id : '')); |
|
20 | 20 | $key = $this->registration->key(); |
21 | 21 | $labelSingular = property_exists($genericModelInstance, 'labelSingular') ? $genericModelInstance->labelSingular : Str::singular($key); |
22 | 22 | $labelPlural = property_exists($genericModelInstance, 'labelPlural') ? $genericModelInstance->labelPlural : Str::plural($key); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return $this->indexPagination($builder); |
88 | 88 | } |
89 | 89 | |
90 | - return $builder->get()->map(function ($model) { |
|
90 | + return $builder->get()->map(function($model) { |
|
91 | 91 | return (new static($this->registration))->manage($model); |
92 | 92 | }); |
93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $paginator = $builder->paginate($this->pageCount); |
117 | 117 | |
118 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
118 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
119 | 119 | return (new static($this->registration))->manage($model); |
120 | 120 | }); |
121 | 121 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | public function guard($verb): Manager |
190 | 190 | { |
191 | - if (! $this->can($verb)) { |
|
191 | + if (!$this->can($verb)) { |
|
192 | 192 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
193 | 193 | } |
194 | 194 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $fields = $this->fields(); |
212 | 212 | |
213 | 213 | foreach ($this->assistantsAsClassNames() as $assistantClass) { |
214 | - if (! method_exists($assistantClass, 'fields')) { |
|
214 | + if (!method_exists($assistantClass, 'fields')) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | 217 | |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | static::$bootedTraitMethods[$baseMethod] = []; |
304 | 304 | |
305 | 305 | foreach (class_uses_recursive($class) as $trait) { |
306 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
306 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
307 | 307 | |
308 | - if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
308 | + if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
309 | 309 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
310 | 310 | } |
311 | 311 | } |