@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | private static function cacheUserVariables() { |
26 | - if(isset(self::$userVariables)) return; |
|
26 | + if(isset(self::$userVariables)) { |
|
27 | + return; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $userId = Auth::user()->id; |
29 | 31 | |
@@ -33,7 +35,9 @@ discard block |
||
33 | 35 | } |
34 | 36 | |
35 | 37 | private static function cacheAdminVariables() { |
36 | - if(isset(self::$adminVariables)) return; |
|
38 | + if(isset(self::$adminVariables)) { |
|
39 | + return; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | foreach (self::where('user_id', 0) as $row) { |
39 | 43 | self::$adminVariables[$row['group']][$row['name']] = $row['value']; |
@@ -43,7 +47,9 @@ discard block |
||
43 | 47 | public static function get($group, $name, $user = null) { |
44 | 48 | $user = $user?: Auth::user()->id; |
45 | 49 | |
46 | - if (!$user || !is_numeric($user)) return; |
|
50 | + if (!$user || !is_numeric($user)) { |
|
51 | + return; |
|
52 | + } |
|
47 | 53 | |
48 | 54 | self::cache(); |
49 | 55 | |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | public static function getGroup($group, $user = null) { |
54 | 60 | $user = $user?: Auth::user()->id; |
55 | 61 | |
56 | - if (!$user || !is_numeric($user)) return; |
|
62 | + if (!$user || !is_numeric($user)) { |
|
63 | + return; |
|
64 | + } |
|
57 | 65 | |
58 | 66 | self::cache(); |
59 | 67 | |
@@ -75,7 +83,9 @@ discard block |
||
75 | 83 | public static function put($group, $name, $value, $user = null) { |
76 | 84 | $user_id = $user?: Auth::user()->id; |
77 | 85 | |
78 | - if (!$user_id || !is_numeric($user_id)) return; |
|
86 | + if (!$user_id || !is_numeric($user_id)) { |
|
87 | + return; |
|
88 | + } |
|
79 | 89 | |
80 | 90 | self::cache(); |
81 | 91 | |
@@ -103,7 +113,9 @@ discard block |
||
103 | 113 | public static function forget($group, $name, $user = null) { |
104 | 114 | $user_id = $user?: Auth::user()->id; |
105 | 115 | |
106 | - if (!$user_id || !is_numeric($user_id)) return; |
|
116 | + if (!$user_id || !is_numeric($user_id)) { |
|
117 | + return; |
|
118 | + } |
|
107 | 119 | |
108 | 120 | self::cache(); |
109 | 121 |
@@ -142,7 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | public function addMenu() |
144 | 144 | { |
145 | - if ($this->isLocked()) return; |
|
145 | + if ($this->isLocked()) { |
|
146 | + return; |
|
147 | + } |
|
146 | 148 | |
147 | 149 | $dashboardId = $this->dashboard()->id; |
148 | 150 | |
@@ -165,14 +167,18 @@ discard block |
||
165 | 167 | $dashboardMenu->addItem([__('Rename dashboard'), 'icon' => 'i cursor'])->on('click', $modal->show()); |
166 | 168 | |
167 | 169 | // there is only one admin default dashboard |
168 | - if ($this->admin) return; |
|
170 | + if ($this->admin) { |
|
171 | + return; |
|
172 | + } |
|
169 | 173 | |
170 | 174 | // ***** add ***** // |
171 | 175 | $modal = $this->add(['Modal', 'title' => __('Add Dashboard')])->set(\Closure::fromCallable([$this, 'addDashboard'])); |
172 | 176 | |
173 | 177 | $dashboardMenu->addItem([__('Add dashboard'), 'icon' => 'add'])->on('click', $modal->show()); |
174 | 178 | |
175 | - if ($this->isSingleDashboard()) return; |
|
179 | + if ($this->isSingleDashboard()) { |
|
180 | + return; |
|
181 | + } |
|
176 | 182 | |
177 | 183 | // ***** reorder ***** // |
178 | 184 | $modal = $this->add(['Modal', 'title' => __('Reorder Dashboards')])->set(\Closure::fromCallable([$this, 'reorderDashboards'])); |
@@ -73,7 +73,9 @@ discard block |
||
73 | 73 | { |
74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
75 | 75 | |
76 | - if (! $entry->get('item')) return; |
|
76 | + if (! $entry->get('item')) { |
|
77 | + return; |
|
78 | + } |
|
77 | 79 | |
78 | 80 | $this->entries->add($entry); |
79 | 81 | } |
@@ -94,14 +96,18 @@ discard block |
||
94 | 96 | { |
95 | 97 | $empty = true; |
96 | 98 | foreach ($this->entries->groupBy('group')->sortKeys() as $group) { |
97 | - if (!$empty) $this->userMenu->addDivider(); |
|
99 | + if (!$empty) { |
|
100 | + $this->userMenu->addDivider(); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | foreach ($group->sortBy('weight') as $entry) { |
100 | 104 | $empty = false; |
101 | 105 | |
102 | 106 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
103 | 107 | |
104 | - if (! $callback = $entry->get('callback')) continue; |
|
108 | + if (! $callback = $entry->get('callback')) { |
|
109 | + continue; |
|
110 | + } |
|
105 | 111 | |
106 | 112 | $callback($item); |
107 | 113 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | return $weight1 <=> $weight2; |
42 | 42 | })->map(function($item, $caption) use ($menu) { |
43 | - if (! ($item['access']?? true)) return; |
|
43 | + if (! ($item['access']?? true)) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | if (!isset($item['link']) && !is_array($item)) { |
46 | 48 | $item = [ |
@@ -58,8 +60,7 @@ discard block |
||
58 | 60 | $submenu = $menu->addMenu($item['caption']); |
59 | 61 | |
60 | 62 | self::addItems($submenu, collect($subitems)); |
61 | - } |
|
62 | - elseif ($subitems = $item['group']?? []) { |
|
63 | + } elseif ($subitems = $item['group']?? []) { |
|
63 | 64 | $subgroup = $menu->addGroup($item['caption']); |
64 | 65 | |
65 | 66 | if (($item['toggle']?? false) && !$menu->in_dropdown) { |
@@ -68,8 +69,7 @@ discard block |
||
68 | 69 | } |
69 | 70 | |
70 | 71 | self::addItems($subgroup, collect($subitems)); |
71 | - } |
|
72 | - elseif ($subitems = $item['accordion']?? []) { |
|
72 | + } elseif ($subitems = $item['accordion']?? []) { |
|
73 | 73 | $accordion = $menu->add(['Accordion']); |
74 | 74 | |
75 | 75 | $section = $accordion->addSection($item['caption']); |
@@ -92,12 +92,10 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | // self::addItems($accordion, collect($subitems)); |
95 | - } |
|
96 | - else { |
|
95 | + } else { |
|
97 | 96 | if (is_a($menu, Accordion::class)) { |
98 | 97 | $menu->add(['View', 'Test']); |
99 | - } |
|
100 | - else { |
|
98 | + } else { |
|
101 | 99 | $menu->addItem($item['caption'], $item['link']?? ''); |
102 | 100 | } |
103 | 101 |
@@ -71,7 +71,9 @@ discard block |
||
71 | 71 | |
72 | 72 | public function setMenu() |
73 | 73 | { |
74 | - if ($this->menu) return; |
|
74 | + if ($this->menu) { |
|
75 | + return; |
|
76 | + } |
|
75 | 77 | |
76 | 78 | //.ui.sidebar, |
77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
@@ -119,7 +121,9 @@ discard block |
||
119 | 121 | |
120 | 122 | public function setMenuRight() |
121 | 123 | { |
122 | - if ($this->menuRight) return; |
|
124 | + if ($this->menuRight) { |
|
125 | + return; |
|
126 | + } |
|
123 | 127 | |
124 | 128 | $this->menuRight = $this->menu->add(new Seeds\RightMenu([ |
125 | 129 | 'ui' => false |
@@ -128,11 +132,15 @@ discard block |
||
128 | 132 | |
129 | 133 | public function setMenuLeft() |
130 | 134 | { |
131 | - if ($this->menuLeft) return; |
|
135 | + if ($this->menuLeft) { |
|
136 | + return; |
|
137 | + } |
|
132 | 138 | |
133 | 139 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
134 | 140 | |
135 | - if (! $this->burger) return; |
|
141 | + if (! $this->burger) { |
|
142 | + return; |
|
143 | + } |
|
136 | 144 | |
137 | 145 | if (! session()->get('menu', 1)) { |
138 | 146 | $this->isMenuLeftVisible = false; |
@@ -151,7 +159,9 @@ discard block |
||
151 | 159 | |
152 | 160 | public function setActionBar() |
153 | 161 | { |
154 | - if ($this->actionBar) return; |
|
162 | + if ($this->actionBar) { |
|
163 | + return; |
|
164 | + } |
|
155 | 165 | |
156 | 166 | $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
157 | 167 | } |
@@ -26,8 +26,7 @@ |
||
26 | 26 | |
27 | 27 | if ($this->admin) { |
28 | 28 | $this->set($joint->info())->setAttr('searchkey', strtolower($joint->caption() . ';' . $joint->info())); |
29 | - } |
|
30 | - else { |
|
29 | + } else { |
|
31 | 30 | if (! $this->locked) { |
32 | 31 | $this->addControl('close', 'applet-close')->setAttr('title', __('Close applet')); |
33 | 32 | } |