@@ -14,22 +14,22 @@ |
||
14 | 14 | $this->collection = $items; |
15 | 15 | |
16 | 16 | if ($model) { |
17 | - $this->collection = $this->collection->prune(function ($node) use ($model) { |
|
17 | + $this->collection = $this->collection->prune(function($node) use ($model) { |
|
18 | 18 | return !in_array($model->id, $node->pluckAncestors('id')); |
19 | 19 | }); |
20 | 20 | } |
21 | 21 | |
22 | - $menu = $this->collection->mapRecursive(function ($node) { |
|
22 | + $menu = $this->collection->mapRecursive(function($node) { |
|
23 | 23 | $entry = $node->entry(); |
24 | 24 | $label = $entry->label; |
25 | - $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())) . '>' : ''; |
|
25 | + $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())).'>' : ''; |
|
26 | 26 | $entry->label .= $label; |
27 | 27 | |
28 | 28 | return $node->replaceEntry($entry); |
29 | 29 | }); |
30 | 30 | |
31 | 31 | $menuitems = collect(); |
32 | - $menu->flatten()->each(function ($node) use ($menuitems) { |
|
32 | + $menu->flatten()->each(function($node) use ($menuitems) { |
|
33 | 33 | $menuitems[] = [ |
34 | 34 | 'label' => $node->label, |
35 | 35 | 'id' => $node->id, |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if ($item->ofType(MenuItem::TYPE_INTERNAL) && $owner = $item->owner) { |
28 | 28 | if (public_method_exists($owner, 'isArchived') && $owner->isArchived()) { |
29 | 29 | unset($items[$k]); |
30 | - } else { |
|
30 | + }else { |
|
31 | 31 | $item->url = $item->url(); |
32 | 32 | |
33 | 33 | // Extra info on admin page. |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | { |
50 | 50 | $collection = NodeCollection::fromArray($items); |
51 | 51 | |
52 | - $collection->mapRecursive(function ($node) { |
|
52 | + $collection->mapRecursive(function($node) { |
|
53 | 53 | return $node->replaceEntry((new MenuItem())->entry($node)); |
54 | 54 | }); |
55 | 55 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $model->parent_id = ($request->input('allow_parent') && $request->input('parent_id')) ? $request->input('parent_id') : null; |
26 | 26 | $model->order = $request->input('order', 0); |
27 | 27 | |
28 | - if($request->input('owner_reference')) { |
|
28 | + if ($request->input('owner_reference')) { |
|
29 | 29 | $owner = ModelReference::fromString($request->input('owner_reference')); |
30 | 30 | $model->owner_type = $owner->className(); |
31 | 31 | $model->owner_id = $owner->id(); |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | if (in_array($menu->order, $sequence)) { |
59 | 59 | foreach ($sequence as $id => $order) { |
60 | 60 | if ($order < $menu->order) { |
61 | - } else { |
|
61 | + }else { |
|
62 | 62 | $sequence[$id]++; |
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - $sequence = $sequence + [$menu->id => $menu->order]; |
|
67 | + $sequence = $sequence+[$menu->id => $menu->order]; |
|
68 | 68 | |
69 | 69 | asort($sequence); |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | private function reorder(array $sequence) |
75 | 75 | { |
76 | - array_walk($sequence, function ($order, $id) { |
|
76 | + array_walk($sequence, function($order, $id) { |
|
77 | 77 | MenuItem::withoutGlobalScope(SoftDeletingScope::class) |
78 | 78 | ->where('id', $id) |
79 | 79 | ->update(['order' => $order]); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $model->parent_id = ($request->input('allow_parent') && $request->input('parent_id')) ? $request->input('parent_id') : null; |
27 | 27 | $model->menu_type = $request->input('menu_type', 'main'); |
28 | 28 | |
29 | - if($request->input('owner_reference')) { |
|
29 | + if ($request->input('owner_reference')) { |
|
30 | 30 | $owner = ModelReference::fromString($request->input('owner_reference')); |
31 | 31 | $model->owner_type = $owner->className(); |
32 | 32 | $model->owner_id = $owner->id(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public function url($locale = null) |
72 | 72 | { |
73 | - if(!$locale) $locale = app()->getLocale(); |
|
73 | + if (!$locale) $locale = app()->getLocale(); |
|
74 | 74 | |
75 | 75 | if ($this->ofType(static::TYPE_INTERNAL) && $owner = $this->owner) { |
76 | 76 | return $owner->url($locale); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'id' => $node->id, |
91 | 91 | 'type' => $node->type, |
92 | 92 | 'label' => $node->label, |
93 | - 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
93 | + 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
94 | 94 | 'url' => $node->url(), |
95 | 95 | 'order' => $node->order, |
96 | 96 | 'owner_type' => $node->owner_type, |
@@ -70,7 +70,9 @@ |
||
70 | 70 | |
71 | 71 | public function url($locale = null) |
72 | 72 | { |
73 | - if(!$locale) $locale = app()->getLocale(); |
|
73 | + if(!$locale) { |
|
74 | + $locale = app()->getLocale(); |
|
75 | + } |
|
74 | 76 | |
75 | 77 | if ($this->ofType(static::TYPE_INTERNAL) && $owner = $this->owner) { |
76 | 78 | return $owner->url($locale); |