@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | return static::make()->href($url)->class($action['class']) |
42 | 42 | ->html($withText ? $icon.' '.$text : $icon) |
43 | - ->unless($withText, function (LinkAction $link) use ($text) { |
|
43 | + ->unless($withText, function(LinkAction $link) use ($text) { |
|
44 | 44 | return $link->tooltip($text); |
45 | 45 | }); |
46 | 46 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setDisabled(bool $disabled) |
76 | 76 | { |
77 | - return $this->if($disabled, function (LinkAction $link) { |
|
77 | + return $this->if($disabled, function(LinkAction $link) { |
|
78 | 78 | return $link->href('#') |
79 | 79 | ->class('btn btn-sm btn-outline-secondary disabled'); |
80 | 80 | }); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | return static::make()->class($action['class']) |
41 | 41 | ->html($withText ? $icon.' '.$text : $icon) |
42 | - ->unless($withText, function (ButtonAction $link) use ($text) { |
|
42 | + ->unless($withText, function(ButtonAction $link) use ($text) { |
|
43 | 43 | return $link->tooltip($text); |
44 | 44 | }); |
45 | 45 | } |
@@ -73,8 +73,9 @@ |
||
73 | 73 | */ |
74 | 74 | public function setDisabled(bool $disabled) |
75 | 75 | { |
76 | - if ( ! $disabled) |
|
77 | - return $this; |
|
76 | + if ( ! $disabled) { |
|
77 | + return $this; |
|
78 | + } |
|
78 | 79 | |
79 | 80 | return $this->attribute('disabled')->class('btn btn-sm btn-outline-secondary'); |
80 | 81 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | if ($this->isEnabled()) { |
67 | 67 | $data = json_decode(file_get_contents($this->path()), true); |
68 | 68 | |
69 | - if ($data['time']) |
|
70 | - $data['time'] = Date::createFromTimestamp($data['time']); |
|
69 | + if ($data['time']) { |
|
70 | + $data['time'] = Date::createFromTimestamp($data['time']); |
|
71 | + } |
|
71 | 72 | } |
72 | 73 | |
73 | 74 | return $data; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function setSelected($name): Collection |
54 | 54 | { |
55 | - return $this->transform(function (Item $item) use ($name) { |
|
55 | + return $this->transform(function(Item $item) use ($name) { |
|
56 | 56 | return $item->setSelected($name); |
57 | 57 | }); |
58 | 58 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function hasAnySelected(): bool |
71 | 71 | { |
72 | - return $this->filter(function (Item $item) { |
|
72 | + return $this->filter(function(Item $item) { |
|
73 | 73 | return $item->isActive(); |
74 | 74 | })->isNotEmpty(); |
75 | 75 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | public function icon($classes = '') : HtmlString |
147 | 147 | { |
148 | 148 | $html = $this->icon |
149 | - ? '<i class="' . $this->icon . ' ' . $classes . '"></i>' |
|
149 | + ? '<i class="'.$this->icon.' '.$classes.'"></i>' |
|
150 | 150 | : ''; |
151 | 151 | |
152 | 152 | return new HtmlString($html); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if ($user->can($permission)) |
236 | 236 | return true; |
237 | 237 | |
238 | - return $this->children->filter(function (Item $item) use ($user) { |
|
238 | + return $this->children->filter(function(Item $item) use ($user) { |
|
239 | 239 | return $item->canSee($user); |
240 | 240 | })->isNotEmpty(); |
241 | 241 | } |
@@ -204,14 +204,15 @@ discard block |
||
204 | 204 | */ |
205 | 205 | protected function parseUrl(array $attributes) : void |
206 | 206 | { |
207 | - if (isset($attributes['url'])) |
|
208 | - $this->setUrl($attributes['url']); |
|
209 | - elseif (isset($attributes['route'])) |
|
210 | - $this->route(...Arr::wrap($attributes['route'])); |
|
211 | - elseif (isset($attributes['action'])) |
|
212 | - $this->action(...Arr::wrap($attributes['action'])); |
|
213 | - else |
|
214 | - $this->setUrl('#'); |
|
207 | + if (isset($attributes['url'])) { |
|
208 | + $this->setUrl($attributes['url']); |
|
209 | + } elseif (isset($attributes['route'])) { |
|
210 | + $this->route(...Arr::wrap($attributes['route'])); |
|
211 | + } elseif (isset($attributes['action'])) { |
|
212 | + $this->action(...Arr::wrap($attributes['action'])); |
|
213 | + } else { |
|
214 | + $this->setUrl('#'); |
|
215 | + } |
|
215 | 216 | } |
216 | 217 | |
217 | 218 | /** |
@@ -225,15 +226,18 @@ discard block |
||
225 | 226 | { |
226 | 227 | $user = $user ?? auth()->user(); |
227 | 228 | |
228 | - if ($user->isSuperAdmin()) |
|
229 | - return true; |
|
229 | + if ($user->isSuperAdmin()) { |
|
230 | + return true; |
|
231 | + } |
|
230 | 232 | |
231 | - if ($user->isOne($this->roles)) |
|
232 | - return true; |
|
233 | + if ($user->isOne($this->roles)) { |
|
234 | + return true; |
|
235 | + } |
|
233 | 236 | |
234 | - foreach ($this->permissions as $permission) |
|
235 | - if ($user->can($permission)) |
|
237 | + foreach ($this->permissions as $permission) { |
|
238 | + if ($user->can($permission)) |
|
236 | 239 | return true; |
240 | + } |
|
237 | 241 | |
238 | 242 | return $this->children->filter(function (Item $item) use ($user) { |
239 | 243 | return $item->canSee($user); |
@@ -61,10 +61,10 @@ |
||
61 | 61 | foreach ($items as $item) { |
62 | 62 | if (is_array($item)) { |
63 | 63 | $this->items->pushSidebarItem($item); |
64 | - } |
|
65 | - elseif (config()->has($item)) { |
|
66 | - foreach (config()->get($item) as $config) |
|
67 | - $this->items->pushSidebarItem($config); |
|
64 | + } elseif (config()->has($item)) { |
|
65 | + foreach (config()->get($item) as $config) { |
|
66 | + $this->items->pushSidebarItem($config); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -86,8 +86,9 @@ |
||
86 | 86 | */ |
87 | 87 | public function packageName(): string |
88 | 88 | { |
89 | - if (empty($this->package)) |
|
90 | - throw new Exception('The package name is required'); |
|
89 | + if (empty($this->package)) { |
|
90 | + throw new Exception('The package name is required'); |
|
91 | + } |
|
91 | 92 | |
92 | 93 | return Str::slug($this->package); |
93 | 94 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | protected function publishMultipleConfig(): void |
97 | 97 | { |
98 | 98 | $files = Collection::make($this->configFilesPaths()) |
99 | - ->mapWithKeys(function ($file) { |
|
99 | + ->mapWithKeys(function($file) { |
|
100 | 100 | return [$file => config_path($this->vendor.DS.$this->packageName().DS.basename($file))]; |
101 | 101 | }) |
102 | 102 | ->toArray(); |
@@ -160,7 +160,7 @@ |
||
160 | 160 | |
161 | 161 | return tap( |
162 | 162 | view()->make($name, $data, array_merge($this->viewData, $mergeData)), |
163 | - function ($view) { |
|
163 | + function($view) { |
|
164 | 164 | $this->postRenderingView($view); |
165 | 165 | } |
166 | 166 | ); |
@@ -117,8 +117,9 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function selectMetrics($metrics) |
119 | 119 | { |
120 | - if (is_string($metrics)) |
|
121 | - $metrics = config($metrics, []); |
|
120 | + if (is_string($metrics)) { |
|
121 | + $metrics = config($metrics, []); |
|
122 | + } |
|
122 | 123 | |
123 | 124 | app(Manager::class)->setSelected($metrics); |
124 | 125 | |
@@ -153,8 +154,9 @@ discard block |
||
153 | 154 | */ |
154 | 155 | protected function view(string $name, $data = [], $mergeData = []): ViewContract |
155 | 156 | { |
156 | - if ( ! is_null($this->viewNamespace)) |
|
157 | - $name = "{$this->viewNamespace}::{$name}"; |
|
157 | + if ( ! is_null($this->viewNamespace)) { |
|
158 | + $name = "{$this->viewNamespace}::{$name}"; |
|
159 | + } |
|
158 | 160 | |
159 | 161 | $this->preRenderingView(); |
160 | 162 |