@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ]); |
47 | 47 | |
48 | 48 | Entity::create([ |
49 | - 'id' => (string) Str::uuid(), |
|
49 | + 'id' => (string)Str::uuid(), |
|
50 | 50 | 'module_id' => ucmodule('domain')->id, |
51 | 51 | 'record_id' => $domain->getKey(), |
52 | 52 | ]); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ]); |
62 | 62 | |
63 | 63 | Entity::create([ |
64 | - 'id' => (string) Str::uuid(), |
|
64 | + 'id' => (string)Str::uuid(), |
|
65 | 65 | 'module_id' => ucmodule('profile')->id, |
66 | 66 | 'record_id' => $profile->getKey(), |
67 | 67 | ]); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $role->profiles()->attach($profile); |
92 | 92 | |
93 | 93 | Entity::create([ |
94 | - 'id' => (string) Str::uuid(), |
|
94 | + 'id' => (string)Str::uuid(), |
|
95 | 95 | 'module_id' => ucmodule('role')->id, |
96 | 96 | 'record_id' => $role->getKey(), |
97 | 97 | ]); |
@@ -233,26 +233,26 @@ discard block |
||
233 | 233 | |
234 | 234 | if (is_numeric($nameOrId)) { |
235 | 235 | // Use cache |
236 | - $modules = Cache::rememberForever('modules_by_id', function () { |
|
236 | + $modules = Cache::rememberForever('modules_by_id', function() { |
|
237 | 237 | $modulesGroupedById = collect(); |
238 | 238 | Module::all()->map(function($item) use($modulesGroupedById) { |
239 | - $modulesGroupedById[$item->id] = $item; |
|
239 | + $modulesGroupedById[ $item->id ] = $item; |
|
240 | 240 | return $modulesGroupedById; |
241 | 241 | }); |
242 | 242 | return $modulesGroupedById; |
243 | 243 | }); |
244 | - return $modules[(string) $nameOrId]; |
|
244 | + return $modules[ (string)$nameOrId ]; |
|
245 | 245 | } else { |
246 | 246 | // Use cache |
247 | - $modules = Cache::rememberForever('modules_by_name', function () { |
|
247 | + $modules = Cache::rememberForever('modules_by_name', function() { |
|
248 | 248 | $modulesGroupedByName = collect(); |
249 | 249 | Module::all()->map(function($item) use($modulesGroupedByName) { |
250 | - $modulesGroupedByName[$item->name] = $item; |
|
250 | + $modulesGroupedByName[ $item->name ] = $item; |
|
251 | 251 | return $modulesGroupedByName; |
252 | 252 | }); |
253 | 253 | return $modulesGroupedByName; |
254 | 254 | }); |
255 | - return $modules[(string) $nameOrId]; |
|
255 | + return $modules[ (string)$nameOrId ]; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -270,26 +270,26 @@ discard block |
||
270 | 270 | |
271 | 271 | if (is_numeric($nameOrId)) { |
272 | 272 | // Use cache |
273 | - $uitypes = Cache::rememberForever('uitypes_by_id', function () { |
|
273 | + $uitypes = Cache::rememberForever('uitypes_by_id', function() { |
|
274 | 274 | $uitypesGroupedById = collect(); |
275 | 275 | Uitype::all()->map(function($item) use($uitypesGroupedById) { |
276 | - $uitypesGroupedById[$item->id] = $item; |
|
276 | + $uitypesGroupedById[ $item->id ] = $item; |
|
277 | 277 | return $uitypesGroupedById; |
278 | 278 | }); |
279 | 279 | return $uitypesGroupedById; |
280 | 280 | }); |
281 | - return $uitypes[(string) $nameOrId]; |
|
281 | + return $uitypes[ (string)$nameOrId ]; |
|
282 | 282 | } else { |
283 | 283 | // Use cache |
284 | - $uitypes = Cache::rememberForever('uitypes_by_name', function () { |
|
284 | + $uitypes = Cache::rememberForever('uitypes_by_name', function() { |
|
285 | 285 | $uitypesGroupedByName = collect(); |
286 | 286 | Uitype::all()->map(function($item) use($uitypesGroupedByName) { |
287 | - $uitypesGroupedByName[$item->name] = $item; |
|
287 | + $uitypesGroupedByName[ $item->name ] = $item; |
|
288 | 288 | return $uitypesGroupedByName; |
289 | 289 | }); |
290 | 290 | return $uitypesGroupedByName; |
291 | 291 | }); |
292 | - return $uitypes[(string) $nameOrId]; |
|
292 | + return $uitypes[ (string)$nameOrId ]; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
@@ -307,26 +307,26 @@ discard block |
||
307 | 307 | |
308 | 308 | if (is_numeric($nameOrId)) { |
309 | 309 | // Use cache |
310 | - $displaytypes = Cache::rememberForever('displaytypes_by_id', function () { |
|
310 | + $displaytypes = Cache::rememberForever('displaytypes_by_id', function() { |
|
311 | 311 | $displaytypesGroupedById = collect(); |
312 | 312 | Displaytype::all()->map(function($item) use($displaytypesGroupedById) { |
313 | - $displaytypesGroupedById[$item->id] = $item; |
|
313 | + $displaytypesGroupedById[ $item->id ] = $item; |
|
314 | 314 | return $displaytypesGroupedById; |
315 | 315 | }); |
316 | 316 | return $displaytypesGroupedById; |
317 | 317 | }); |
318 | - return $displaytypes[(string) $nameOrId]; |
|
318 | + return $displaytypes[ (string)$nameOrId ]; |
|
319 | 319 | } else { |
320 | 320 | // Use cache |
321 | - $displaytypes = Cache::rememberForever('displaytypes_by_name', function () { |
|
321 | + $displaytypes = Cache::rememberForever('displaytypes_by_name', function() { |
|
322 | 322 | $displaytypesGroupedByName = collect(); |
323 | 323 | Displaytype::all()->map(function($item) use($displaytypesGroupedByName) { |
324 | - $displaytypesGroupedByName[$item->name] = $item; |
|
324 | + $displaytypesGroupedByName[ $item->name ] = $item; |
|
325 | 325 | return $displaytypesGroupedByName; |
326 | 326 | }); |
327 | 327 | return $displaytypesGroupedByName; |
328 | 328 | }); |
329 | - return $displaytypes[(string) $nameOrId]; |
|
329 | + return $displaytypes[ (string)$nameOrId ]; |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
@@ -344,26 +344,26 @@ discard block |
||
344 | 344 | |
345 | 345 | if (is_numeric($nameOrId)) { |
346 | 346 | // Use cache |
347 | - $capabilities = Cache::rememberForever('capabilities_by_id', function () { |
|
347 | + $capabilities = Cache::rememberForever('capabilities_by_id', function() { |
|
348 | 348 | $capabilitiesGroupedById = collect(); |
349 | 349 | Capability::all()->map(function($item) use($capabilitiesGroupedById) { |
350 | - $capabilitiesGroupedById[$item->id] = $item; |
|
350 | + $capabilitiesGroupedById[ $item->id ] = $item; |
|
351 | 351 | return $capabilitiesGroupedById; |
352 | 352 | }); |
353 | 353 | return $capabilitiesGroupedById; |
354 | 354 | }); |
355 | - return $capabilities[(string) $nameOrId]; |
|
355 | + return $capabilities[ (string)$nameOrId ]; |
|
356 | 356 | } else { |
357 | 357 | // Use cache |
358 | - $capabilities = Cache::rememberForever('capabilities_by_name', function () { |
|
358 | + $capabilities = Cache::rememberForever('capabilities_by_name', function() { |
|
359 | 359 | $capabilitiesGroupedByName = collect(); |
360 | 360 | Capability::all()->map(function($item) use($capabilitiesGroupedByName) { |
361 | - $capabilitiesGroupedByName[$item->name] = $item; |
|
361 | + $capabilitiesGroupedByName[ $item->name ] = $item; |
|
362 | 362 | return $capabilitiesGroupedByName; |
363 | 363 | }); |
364 | 364 | return $capabilitiesGroupedByName; |
365 | 365 | }); |
366 | - return $capabilities[(string) $nameOrId]; |
|
366 | + return $capabilities[ (string)$nameOrId ]; |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @param string $type |
402 | 402 | * @return array |
403 | 403 | */ |
404 | - public function getDatatableColumns(Module $module, $filterId=null, $type='list'): array |
|
404 | + public function getDatatableColumns(Module $module, $filterId = null, $type = 'list'): array |
|
405 | 405 | { |
406 | 406 | $columns = [ ]; |
407 | 407 |
@@ -109,7 +109,7 @@ |
||
109 | 109 | if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) { |
110 | 110 | // Search related records and get all ids |
111 | 111 | $searchResults = new Search(); |
112 | - $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns); |
|
112 | + $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns); |
|
113 | 113 | $recordIds = $searchResults->search($value)->pluck('searchable.id'); |
114 | 114 | |
115 | 115 | // Search records linked to record ids got previously |
@@ -22,7 +22,7 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | Entity::create([ |
25 | - 'id' => (string) Str::uuid(), |
|
25 | + 'id' => (string)Str::uuid(), |
|
26 | 26 | 'module_id' => $event->module->id, |
27 | 27 | 'record_id' => $event->record->getKey(), |
28 | 28 | ]); |
@@ -179,7 +179,7 @@ |
||
179 | 179 | */ |
180 | 180 | public function isActiveOnDomain(Domain $domain) : bool |
181 | 181 | { |
182 | - $moduleDomains = Cache::rememberForever('module_'.$this->name.'_domains', function () { |
|
182 | + $moduleDomains = Cache::rememberForever('module_'.$this->name.'_domains', function() { |
|
183 | 183 | return $this->domains; |
184 | 184 | }); |
185 | 185 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function rolesOnDomain($domain) : Collection |
117 | 117 | { |
118 | - return Cache::remember('domain_'.$domain->slug.'_roles', 600, function () use($domain) { |
|
118 | + return Cache::remember('domain_'.$domain->slug.'_roles', 600, function() use($domain) { |
|
119 | 119 | $roles = collect(); |
120 | 120 | |
121 | 121 | foreach ($this->privileges->where('domain_id', $domain->id) as $privilege) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $hasRole = false; |
156 | 156 | |
157 | - $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) { |
|
157 | + $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) { |
|
158 | 158 | return $domain->findDescendants()->get(); |
159 | 159 | }); |
160 | 160 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | { |
181 | 181 | $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities'; |
182 | 182 | |
183 | - return Cache::remember($keyName, 600, function () use($domain, $module) { |
|
183 | + return Cache::remember($keyName, 600, function() use($domain, $module) { |
|
184 | 184 | $capabilities = collect(); |
185 | 185 | |
186 | 186 | // Get the domain and all its parents |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel'; |
236 | 236 | |
237 | - return Cache::remember($keyName, 600, function () use($domain) { |
|
237 | + return Cache::remember($keyName, 600, function() use($domain) { |
|
238 | 238 | |
239 | 239 | $hasCapability = false; |
240 | 240 |
@@ -187,7 +187,7 @@ |
||
187 | 187 | */ |
188 | 188 | protected function getNotAdminModulesAttribute() : array |
189 | 189 | { |
190 | - return Cache::rememberForever('not_admin_modules', function () { |
|
190 | + return Cache::rememberForever('not_admin_modules', function() { |
|
191 | 191 | $modules = [ ]; |
192 | 192 | |
193 | 193 | foreach ($this->modules()->get() as $module) { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | $modelClass = $module->model_class; |
53 | 53 | |
54 | 54 | if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) { |
55 | - $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns); |
|
55 | + $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param Module $module |
76 | 76 | * @param boolean $forBlade |
77 | 77 | */ |
78 | - protected function preProcess(?Domain &$domain, Module $module, Request $request, $forBlade=true) |
|
78 | + protected function preProcess(?Domain &$domain, Module $module, Request $request, $forBlade = true) |
|
79 | 79 | { |
80 | 80 | // If we don't use multi domains, find the first one |
81 | 81 | if (!uccello()->useMultiDomains()) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | $keyName = $getAdminModules ? 'modules_all' : 'modules_not_admin'; |
159 | 159 | |
160 | - return Cache::rememberForever($keyName, function () use($getAdminModules) { |
|
160 | + return Cache::rememberForever($keyName, function() use($getAdminModules) { |
|
161 | 161 | $modules = [ ]; |
162 | 162 | |
163 | 163 | $allModules = Module::all(); |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function getDomainsTreeHtml() |
217 | 217 | { |
218 | - return Cache::remember('users', 600, function () { // 10 minutes |
|
218 | + return Cache::remember('users', 600, function() { // 10 minutes |
|
219 | 219 | $domainsTreeHtml = '<ul class="tree tree-level-0">'; |
220 | 220 | |
221 | 221 | $rootDomains = app('uccello')->getRootDomains(); |
222 | - foreach($rootDomains as $root) { |
|
222 | + foreach ($rootDomains as $root) { |
|
223 | 223 | |
224 | 224 | $descendants = $root->findDescendants()->get(); |
225 | 225 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $html = $tree->render( |
229 | 229 | 'ul', |
230 | - function ($node) { |
|
230 | + function($node) { |
|
231 | 231 | if (auth()->user()->hasRoleOnDomain($node)) { |
232 | 232 | $currentClass = ''; |
233 | 233 | if ($node->id === $this->domain->id) { |
@@ -234,8 +234,7 @@ |
||
234 | 234 | $currentClass = 'class="green-text"'; |
235 | 235 | } |
236 | 236 | return '<li><a href="'.ucroute('uccello.home', $node).'" '.$currentClass.'>'.$node->name.'</a>{sub-tree}</li>'; |
237 | - } |
|
238 | - elseif (auth()->user()->hasRoleOnDescendantDomain($node)) { |
|
237 | + } elseif (auth()->user()->hasRoleOnDescendantDomain($node)) { |
|
239 | 238 | return '<li>'.$node->name.'{sub-tree}</li>'; |
240 | 239 | } else { |
241 | 240 | return ''; |