@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | |
24 | 24 | public function manager(Manager $manager) |
25 | 25 | { |
26 | - $this->manager = $manager; |
|
26 | + $this->manager = $manager; |
|
27 | 27 | |
28 | - if (! $manager->model() instanceof ProvidesUrl) { |
|
29 | - throw new \Exception('UrlAssistant requires the model interfaced by ' . ProvidesUrl::class . '.'); |
|
28 | + if (!$manager->model() instanceof ProvidesUrl) { |
|
29 | + throw new \Exception('UrlAssistant requires the model interfaced by '.ProvidesUrl::class.'.'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $this->model = $manager->model(); |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | InputField::make('url-slugs') |
55 | 55 | ->validation( |
56 | 56 | [ |
57 | - 'url-slugs' => ['array', 'min:1', new UniqueUrlSlugRule(($this->model && $this->model->exists) ? $this->model : null),], |
|
57 | + 'url-slugs' => ['array', 'min:1', new UniqueUrlSlugRule(($this->model && $this->model->exists) ? $this->model : null), ], |
|
58 | 58 | ], |
59 | 59 | [], |
60 | 60 | [ |
61 | 61 | 'url-slugs.*' => 'taalspecifieke link', |
62 | 62 | ]) |
63 | 63 | ->view('chief::back._fields.url-slugs') |
64 | - ->viewData(['fields' => UrlSlugFields::fromModel($this->model) ]), |
|
64 | + ->viewData(['fields' => UrlSlugFields::fromModel($this->model)]), |
|
65 | 65 | ]); |
66 | 66 | } |
67 | 67 |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $this->filters()->apply($builder); |
73 | 73 | |
74 | 74 | $results = $builder->get(); |
75 | - } else { |
|
75 | + }else { |
|
76 | 76 | $results = $model::all(); |
77 | 77 | } |
78 | 78 | |
79 | - return $results->map(function ($model) { |
|
79 | + return $results->map(function($model) { |
|
80 | 80 | return (new static($this->registration))->manage($model); |
81 | 81 | }); |
82 | 82 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | public function guard($verb): Manager |
146 | 146 | { |
147 | - if (! $this->can($verb)) { |
|
147 | + if (!$this->can($verb)) { |
|
148 | 148 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
149 | 149 | } |
150 | 150 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $fields = $this->fields(); |
168 | 168 | |
169 | 169 | foreach ($this->assistants() as $assistant) { |
170 | - if (! method_exists($assistant, 'fields')) { |
|
170 | + if (!method_exists($assistant, 'fields')) { |
|
171 | 171 | continue; |
172 | 172 | } |
173 | 173 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | // Could be translatable field |
208 | 208 | if ($this->isTranslatableKey($field)) { |
209 | - $attribute = substr($field, strrpos($field, '.') + 1); |
|
209 | + $attribute = substr($field, strrpos($field, '.')+1); |
|
210 | 210 | $locale = substr($field, strlen('trans.'), 2); |
211 | 211 | |
212 | 212 | return $this->model->getTranslationFor($attribute, $locale); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | // Make our media fields able to be translatable as well... |
246 | 246 | if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) { |
247 | - throw new \Exception('Cannot process the ' . $field->key . ' media field. Currently no support for translatable media files. We should fix this!'); |
|
247 | + throw new \Exception('Cannot process the '.$field->key.' media field. Currently no support for translatable media files. We should fix this!'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | // Okay so this is a bit odd but since all translations are expected to be inside the trans |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function fromKeys($keys) |
21 | 21 | { |
22 | - $keys = (array) $keys; |
|
22 | + $keys = (array)$keys; |
|
23 | 23 | $collection = collect(); |
24 | 24 | |
25 | 25 | /** @var Managers */ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public static function fromTags($tags) |
35 | 35 | { |
36 | - $tags = (array) $tags; |
|
36 | + $tags = (array)$tags; |
|
37 | 37 | $collection = collect(); |
38 | 38 | |
39 | 39 | /** @var Managers */ |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | private static function fromManagers(Collection $collection) |
54 | 54 | { |
55 | - return new static(...$collection->reject(function ($manager) { |
|
55 | + return new static(...$collection->reject(function($manager) { |
|
56 | 56 | return !$manager->can('index'); |
57 | - })->map(function ($manager) { |
|
57 | + })->map(function($manager) { |
|
58 | 58 | return new NavItem($manager->details()->plural, $manager->route('index'), [ |
59 | 59 | 'key' => $manager->details()->key, |
60 | 60 | 'tags' => app(Register::class)->filterByKey($manager->details()->key)->first()->tags() |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | public function rejectKeys($keys) |
66 | 66 | { |
67 | - $keys = (array) $keys; |
|
67 | + $keys = (array)$keys; |
|
68 | 68 | |
69 | 69 | foreach ($this->items as $k => $item) { |
70 | 70 | if (in_array($item->details('key', ''), $keys)) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function rejectTags($tags) |
79 | 79 | { |
80 | - $tags = (array) $tags; |
|
80 | + $tags = (array)$tags; |
|
81 | 81 | |
82 | 82 | foreach ($this->items as $k => $item) { |
83 | 83 | if (count(array_intersect($item->details('tags', []), $tags)) > 0) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $output = ''; |
120 | 120 | |
121 | 121 | foreach ($this->items as $item) { |
122 | - $output .= '<a class="' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">'; |
|
122 | + $output .= '<a class="'.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">'; |
|
123 | 123 | $output .= $title ?? ucfirst($item->title()); |
124 | 124 | $output .= '</a>'; |
125 | 125 | } |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | |
147 | 147 | $items = ''; |
148 | 148 | foreach ($this->items as $item) { |
149 | - $items .= '<a class="' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">'; |
|
149 | + $items .= '<a class="'.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">'; |
|
150 | 150 | $items .= $item->title(); |
151 | 151 | $items .= '</a>'; |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Surround within vue dropdown |
155 | 155 | $output = '<dropdown>'; |
156 | - $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'. ($title ?? 'Collecties') .'</span>'; |
|
156 | + $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.($title ?? 'Collecties').'</span>'; |
|
157 | 157 | $output .= '<div v-cloak class="dropdown-box inset-s">'; |
158 | 158 | $output .= $items; |
159 | 159 | $output .= '</div>'; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function anyApplied(): bool |
37 | 37 | { |
38 | 38 | foreach ($this->all() as $filter) { |
39 | - if(request()->filled($filter->name)) { |
|
39 | + if (request()->filled($filter->name)) { |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | { |
49 | 49 | $requestInput = request()->all(); |
50 | 50 | |
51 | - return array_reduce($this->all(), function ($carry, Filter $filter) use ($requestInput) { |
|
52 | - return $carry . $filter->render($requestInput); |
|
51 | + return array_reduce($this->all(), function($carry, Filter $filter) use ($requestInput) { |
|
52 | + return $carry.$filter->render($requestInput); |
|
53 | 53 | }, ''); |
54 | 54 | } |
55 | 55 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | |
66 | 66 | public function keys(): array |
67 | 67 | { |
68 | - return array_map(function (Filter $filter) { |
|
68 | + return array_map(function(Filter $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) { |
|
75 | + array_map(function(Filter $filter) { |
|
76 | 76 | }, $filters); |
77 | 77 | } |
78 | 78 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | public function offsetSet($offset, $value) |
99 | 99 | { |
100 | - if (! $value instanceof Filter) { |
|
101 | - throw new \InvalidArgumentException('Passed value must be of type ' . Filter::class); |
|
100 | + if (!$value instanceof Filter) { |
|
101 | + throw new \InvalidArgumentException('Passed value must be of type '.Filter::class); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $this->filters[$offset] = $value; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | private function sanitizeFilters(array $filters) |
118 | 118 | { |
119 | - return array_map(function ($filter) { |
|
119 | + return array_map(function($filter) { |
|
120 | 120 | if (is_string($filter) && class_exists($filter)) { |
121 | 121 | return $filter::init(); |
122 | 122 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function get(): string |
36 | 36 | { |
37 | - $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : ''; |
|
37 | + $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : ''; |
|
38 | 38 | $guessedParentViewName = $this->parent ? $this->parent->viewKey() : ''; |
39 | 39 | $guessedViewName = $this->viewable->viewKey(); |
40 | 40 | |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | foreach ($viewPaths as $viewPath) { |
56 | - if (! view()->exists($viewPath)) { |
|
56 | + if (!view()->exists($viewPath)) { |
|
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
60 | 60 | return $viewPath; |
61 | 61 | } |
62 | 62 | |
63 | - if (! view()->exists($basePath.'show')){ |
|
63 | + if (!view()->exists($basePath.'show')) { |
|
64 | 64 | throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the default view ['.$basePath.'show] exists.'); |
65 | 65 | } |
66 | 66 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | // If this is a '/' slug, it indicates the homepage for this locale. In this case, |
41 | 41 | // we wont be trimming the slash |
42 | - if($slug === '/') return $slug; |
|
42 | + if ($slug === '/') return $slug; |
|
43 | 43 | |
44 | 44 | if ($this->startsWithBaseUrlSegment($slug)) { |
45 | 45 | $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/'); |
@@ -39,7 +39,9 @@ |
||
39 | 39 | |
40 | 40 | // If this is a '/' slug, it indicates the homepage for this locale. In this case, |
41 | 41 | // we wont be trimming the slash |
42 | - if($slug === '/') return $slug; |
|
42 | + if($slug === '/') { |
|
43 | + return $slug; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | if ($this->startsWithBaseUrlSegment($slug)) { |
45 | 47 | $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function findAll(): Collection |
73 | 73 | { |
74 | - return $this->model->published()->get()->map(function ($model) { |
|
74 | + return $this->model->published()->get()->map(function($model) { |
|
75 | 75 | return $this->managers->findByModel($model); |
76 | 76 | }); |
77 | 77 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function guard($verb): Assistant |
95 | 95 | { |
96 | - if (! $this->can($verb)) { |
|
96 | + if (!$this->can($verb)) { |
|
97 | 97 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
98 | 98 | } |
99 | 99 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $label = $this->publicationStatusAsPlainLabel(); |
111 | 111 | |
112 | - if ($plain || ! $this->hasPreviewUrl()) { |
|
112 | + if ($plain || !$this->hasPreviewUrl()) { |
|
113 | 113 | return $label; |
114 | 114 | } |
115 | 115 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function previewUrl(): string |
145 | 145 | { |
146 | 146 | if (!$this->hasPreviewUrl()) { |
147 | - throw new \Exception('Managed model ' . get_class($this->model) . ' should implement ' . ProvidesUrl::class); |
|
147 | + throw new \Exception('Managed model '.get_class($this->model).' should implement '.ProvidesUrl::class); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $this->model->previewUrl(); |