@@ -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 | } |
@@ -40,11 +40,11 @@ |
||
40 | 40 | |
41 | 41 | public static function notAllowedAction($action, string $managerKey) |
42 | 42 | { |
43 | - return new self('Not allowed to ' . $action . ' a model. ' . ucfirst($action) . ' route is not allowed by the ' . $managerKey . ' manager.'); |
|
43 | + return new self('Not allowed to '.$action.' a model. '.ucfirst($action).' route is not allowed by the '.$managerKey.' manager.'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public static function notAllowedPermission($permission, string $managerKey) |
47 | 47 | { |
48 | - return new self('Not allowed permission for ' . $permission . ' on a model as managed by the ' . $managerKey . ' manager.'); |
|
48 | + return new self('Not allowed permission for '.$permission.' on a model as managed by the '.$managerKey.' manager.'); |
|
49 | 49 | } |
50 | 50 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | return $this->indexPagination($builder); |
92 | 92 | } |
93 | 93 | |
94 | - return $builder->get()->map(function ($model) { |
|
94 | + return $builder->get()->map(function($model) { |
|
95 | 95 | return (new static($this->registration))->manage($model); |
96 | 96 | }); |
97 | 97 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $paginator = $builder->paginate($this->pageCount); |
121 | 121 | |
122 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
122 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
123 | 123 | return (new static($this->registration))->manage($model); |
124 | 124 | }); |
125 | 125 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | public function editFields(): Fields |
237 | 237 | { |
238 | - return $this->fieldsWithAssistantFields()->map(function (Field $field) { |
|
238 | + return $this->fieldsWithAssistantFields()->map(function(Field $field) { |
|
239 | 239 | return $field->model($this->model); |
240 | 240 | }); |
241 | 241 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | static::$bootedTraitMethods[$baseMethod] = []; |
329 | 329 | |
330 | 330 | foreach (class_uses_recursive($class) as $trait) { |
331 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
331 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
332 | 332 | |
333 | 333 | if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
334 | 334 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
@@ -16,7 +16,7 @@ discard block |
||
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); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | return new Details( |
33 | 33 | $id, |
34 | 34 | $key, |
35 | - $labelSingular . '', |
|
36 | - $labelPlural . '', |
|
35 | + $labelSingular.'', |
|
36 | + $labelPlural.'', |
|
37 | 37 | $internal_label, |
38 | - $title . '' |
|
38 | + $title.'' |
|
39 | 39 | ); |
40 | 40 | } |
41 | 41 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function isTagged($tags): bool |
33 | 33 | { |
34 | - return count(array_intersect($this->tags, (array) $tags)) > 0; |
|
34 | + return count(array_intersect($this->tags, (array)$tags)) > 0; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function isUntagged(): bool |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function render(): string |
43 | 43 | { |
44 | - $output = '<a class="' . (isActiveUrl($this->url()) ? 'active' : '') . '" href="' . $this->url() . '">'; |
|
44 | + $output = '<a class="'.(isActiveUrl($this->url()) ? 'active' : '').'" href="'.$this->url().'">'; |
|
45 | 45 | $output .= ucfirst($this->label()); |
46 | 46 | $output .= '</a>'; |
47 | 47 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function untagged(): self |
32 | 32 | { |
33 | - $filteredItems = array_filter($this->items, function(NavItem $navItem){ |
|
33 | + $filteredItems = array_filter($this->items, function(NavItem $navItem) { |
|
34 | 34 | return $navItem->isUntagged(); |
35 | 35 | }); |
36 | 36 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $instance = new static(); |
43 | 43 | |
44 | - foreach($navItems as $item) { |
|
44 | + foreach ($navItems as $item) { |
|
45 | 45 | $instance->add($item); |
46 | 46 | } |
47 | 47 | |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | |
56 | 56 | public function render(): string |
57 | 57 | { |
58 | - return array_reduce($this->items, function($carry, $item){ |
|
59 | - return $carry .'<li>'. $item->render() . '</li>'; |
|
58 | + return array_reduce($this->items, function($carry, $item) { |
|
59 | + return $carry.'<li>'.$item->render().'</li>'; |
|
60 | 60 | } ,''); |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function renderDropdown(string $label): string |
64 | 64 | { |
65 | - $items = array_reduce($this->items, function($carry, $item){ |
|
66 | - return $carry . $item->render(); |
|
65 | + $items = array_reduce($this->items, function($carry, $item) { |
|
66 | + return $carry.$item->render(); |
|
67 | 67 | } ,''); |
68 | 68 | |
69 | 69 | // Surround with vue dropdown |
70 | 70 | $output = '<dropdown>'; |
71 | - $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">' . $label . '</span>'; |
|
72 | - $output .= '<div v-cloak class="dropdown-box inset-s">' . $items . '</div></dropdown>'; |
|
71 | + $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.$label.'</span>'; |
|
72 | + $output .= '<div v-cloak class="dropdown-box inset-s">'.$items.'</div></dropdown>'; |
|
73 | 73 | |
74 | 74 | return $output; |
75 | 75 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if ($item->ofType(static::TYPE_INTERNAL) && $page = $item->page) { |
105 | 105 | if (public_method_exists($page, 'isArchived') && $page->isArchived()) { |
106 | 106 | unset($items[$k]); |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $item->url = self::composePageUrl($item, $page); |
109 | 109 | $item->page_label = public_method_exists($page, 'menuLabel') ? $page->menuLabel() : ''; |
110 | 110 | $item->hidden_in_menu = $page->hidden_in_menu; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'id' => $node->id, |
154 | 154 | 'type' => $node->type, |
155 | 155 | 'label' => $node->label, |
156 | - 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
156 | + 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
157 | 157 | 'url' => $node->url, |
158 | 158 | 'order' => $node->order, |
159 | 159 | 'page_id' => $node->page_id, |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Thinktomorrow\Chief\Urls\Field; |
6 | 6 | |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | // Push update to homepage setting value |
21 | 21 | // TODO: we should just fetch the homepages and push that instead... |
22 | - UrlRecord::getByModel($model)->reject(function ($record) { |
|
22 | + UrlRecord::getByModel($model)->reject(function($record) { |
|
23 | 23 | return ($record->isRedirect() || !$record->isHomepage()); |
24 | - })->each(function ($record) { |
|
24 | + })->each(function($record) { |
|
25 | 25 | app(ChangeHomepage::class)->onUrlChanged($record); |
26 | 26 | }); |
27 | 27 | } |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | |
19 | 19 | public static function redirectsFromModel(ProvidesUrl $model) |
20 | 20 | { |
21 | - $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) { |
|
21 | + $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) { |
|
22 | 22 | return !$record->isRedirect(); |
23 | 23 | })->sortByDesc('created_at'); |
24 | 24 | |
25 | 25 | $fields = new static([]); |
26 | 26 | |
27 | 27 | foreach ($records as $record) { |
28 | - $key = 'redirects-' . $record->locale . '-' . $record->slug; |
|
28 | + $key = 'redirects-'.$record->locale.'-'.$record->slug; |
|
29 | 29 | $fields[$key] = UrlSlugField::make($key) |
30 | 30 | ->setUrlRecord($record) |
31 | 31 | ->setFullUrl($model->resolveUrl($record->locale, $record->slug)); |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | $fields = new static([]); |
61 | 61 | |
62 | 62 | foreach ($locales as $locale) { |
63 | - $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale) |
|
63 | + $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale) |
|
64 | 64 | ->setBaseUrlSegment($model->baseUrlSegment($locale)) |
65 | - ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) . '/') |
|
66 | - ->name('url-slugs[' . $locale . ']') |
|
65 | + ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/') |
|
66 | + ->name('url-slugs['.$locale.']') |
|
67 | 67 | ->label($locale); |
68 | 68 | } |
69 | 69 | |
@@ -76,19 +76,19 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void |
78 | 78 | { |
79 | - $records = UrlRecord::getByModel($model)->reject(function ($record) { |
|
79 | + $records = UrlRecord::getByModel($model)->reject(function($record) { |
|
80 | 80 | return $record->isRedirect(); |
81 | 81 | })->sortBy('locale'); |
82 | 82 | |
83 | 83 | foreach ($records as $record) { |
84 | - if (!isset($fields['url-slugs.' . $record->locale])) { |
|
84 | + if (!isset($fields['url-slugs.'.$record->locale])) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
88 | - $fields['url-slugs.' . $record->locale] |
|
88 | + $fields['url-slugs.'.$record->locale] |
|
89 | 89 | ->setUrlRecord($record) |
90 | 90 | ->setBaseUrlSegment($model->baseUrlSegment($record->locale)) |
91 | - ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) . '/'); |
|
91 | + ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |