@@ -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 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function fieldArrangement($key = null): FieldArrangement |
134 | 134 | { |
135 | 135 | if ($key == 'create') { |
136 | - return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function ($field) { |
|
136 | + return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function($field) { |
|
137 | 137 | return in_array($field->key, ['title']); |
138 | 138 | })); |
139 | 139 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function saveFields(Request $request) |
166 | 166 | { |
167 | 167 | // Store the morph_key upon creation |
168 | - if ($this->model instanceof MorphableContract && ! $this->model->morph_key) { |
|
168 | + if ($this->model instanceof MorphableContract && !$this->model->morph_key) { |
|
169 | 169 | $this->model->morph_key = $this->model->morphKey(); |
170 | 170 | } |
171 | 171 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if (is_array_empty($translation)) { |
211 | 211 | |
212 | 212 | // Nullify all values |
213 | - $trans[$locale] = array_map(function ($value) { |
|
213 | + $trans[$locale] = array_map(function($value) { |
|
214 | 214 | return null; |
215 | 215 | }, $translation); |
216 | 216 | continue; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $class = $this->pageState->isOnline() ? 'text-success' : 'text-warning'; |
30 | 30 | |
31 | - return '<span class="inline-xs stack-s '.$class.'">' . $this->stateAsLabel() . '</span>'; |
|
31 | + return '<span class="inline-xs stack-s '.$class.'">'.$this->stateAsLabel().'</span>'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $registrations = collect($this->register->filterByTag($tag)->all()); |
52 | 52 | |
53 | - return $registrations->map(function ($registration) { |
|
53 | + return $registrations->map(function($registration) { |
|
54 | 54 | return $this->instance($registration); |
55 | 55 | }); |
56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | $registrations = collect($this->register->filterByTag($tag)->all()); |
67 | 67 | |
68 | - return $registrations->map(function ($registration) { |
|
68 | + return $registrations->map(function($registration) { |
|
69 | 69 | return $this->instance($registration)->details(); |
70 | 70 | }); |
71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | //return array with group name and values |
77 | 77 | $grouped = []; |
78 | 78 | |
79 | - $managers = $managers->map(function (Manager $item) { |
|
79 | + $managers = $managers->map(function(Manager $item) { |
|
80 | 80 | return [ |
81 | 81 | 'id' => $item->details()->id, |
82 | 82 | 'group' => $item->details()->plural, |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $registrations = collect($this->register->all()); |
92 | 92 | |
93 | - return $registrations->map(function ($registration) { |
|
93 | + return $registrations->map(function($registration) { |
|
94 | 94 | return $this->instance($registration); |
95 | 95 | }); |
96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $assistants = collect(); |
101 | 101 | |
102 | - foreach($this->all() as $manager) { |
|
102 | + foreach ($this->all() as $manager) { |
|
103 | 103 | $assistants = $assistants->merge($manager->assistants(false)); |
104 | 104 | } |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | public function anyRegisteredByTag($tag) |
110 | 110 | { |
111 | - return ! empty($this->register->filterByTag($tag)->all()); |
|
111 | + return !empty($this->register->filterByTag($tag)->all()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -51,7 +51,7 @@ |
||
51 | 51 | public function assistant(string $assistantKey): Assistant |
52 | 52 | { |
53 | 53 | if (!$this->isAssistedBy($assistantKey)) { |
54 | - throw new MissingAssistant('No assistant [' . $assistantKey . '] registered on manager ' . static::class); |
|
54 | + throw new MissingAssistant('No assistant ['.$assistantKey.'] registered on manager '.static::class); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $instance = app($this->getAssistantClass($assistantKey)); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function scopeUnarchived($query) |
25 | 25 | { |
26 | - $query->withoutGlobalScope(ArchiveScope::class)->where(PageState::KEY,'<>', PageState::ARCHIVED); |
|
26 | + $query->withoutGlobalScope(ArchiveScope::class)->where(PageState::KEY, '<>', PageState::ARCHIVED); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function scopeWithArchived($query) |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | $transitions = []; |
97 | 97 | |
98 | - foreach($this->transitions as $transitionKey => $transition){ |
|
98 | + foreach ($this->transitions as $transitionKey => $transition) { |
|
99 | 99 | if (false !== array_search($this->statefulContract->stateOf($this->stateKey), $transition['from'])) { |
100 | 100 | $transitions[] = $transitionKey; |
101 | 101 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | private function validateTransitions() |
108 | 108 | { |
109 | 109 | foreach ($this->transitions as $transitionKey => $transition) { |
110 | - if (!array_key_exists('from', $transition) || !array_key_exists('to',$transition) || !is_array($transition['from'])) { |
|
110 | + if (!array_key_exists('from', $transition) || !array_key_exists('to', $transition) || !is_array($transition['from'])) { |
|
111 | 111 | throw StateException::malformedTransition($transitionKey, $this); |
112 | 112 | } |
113 | 113 |
@@ -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 | } |