@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | use EasyPanel\Contracts\CRUDComponent; |
4 | 4 | |
5 | -if(! function_exists('getRouteName')) { |
|
6 | - function getRouteName(){ |
|
5 | +if (!function_exists('getRouteName')) { |
|
6 | + function getRouteName() { |
|
7 | 7 | $routeName = config('easy_panel.route_prefix'); |
8 | 8 | $routeName = trim($routeName, '/'); |
9 | 9 | $routeName = str_replace('/', '.', $routeName); |
@@ -11,19 +11,19 @@ discard block |
||
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | -if(! function_exists('getCrudConfig')) { |
|
15 | - function getCrudConfig($name){ |
|
14 | +if (!function_exists('getCrudConfig')) { |
|
15 | + function getCrudConfig($name) { |
|
16 | 16 | |
17 | - $crudName=ucfirst($name); |
|
17 | + $crudName = ucfirst($name); |
|
18 | 18 | $namespace = "\\App\\CRUD\\{$crudName}Component"; |
19 | 19 | |
20 | - if (!class_exists($namespace)){ |
|
20 | + if (!class_exists($namespace)) { |
|
21 | 21 | abort(403, "Class with {$namespace} namespace doesn't exist"); |
22 | 22 | } |
23 | 23 | |
24 | 24 | $instance = app()->make($namespace); |
25 | 25 | |
26 | - if (!$instance instanceof CRUDComponent){ |
|
26 | + if (!$instance instanceof CRUDComponent) { |
|
27 | 27 | abort(403, "{$namespace} should implement CRUDComponent interface"); |
28 | 28 | } |
29 | 29 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -if(! function_exists('crud')) { |
|
35 | - function crud($name){ |
|
34 | +if (!function_exists('crud')) { |
|
35 | + function crud($name) { |
|
36 | 36 | return \EasyPanel\Models\CRUD::query()->where('name', $name)->first(); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -if(! function_exists('get_icon')) { |
|
41 | - function get_icon($type){ |
|
40 | +if (!function_exists('get_icon')) { |
|
41 | + function get_icon($type) { |
|
42 | 42 | $array = [ |
43 | 43 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
44 | 44 | 'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | 'truck' => ['product', 'products', 'shops', 'shop'], |
56 | 56 | 'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'], |
57 | 57 | ]; |
58 | - foreach ($array as $key => $arrayValues){ |
|
59 | - if(in_array($type, $arrayValues)){ |
|
58 | + foreach ($array as $key => $arrayValues) { |
|
59 | + if (in_array($type, $arrayValues)) { |
|
60 | 60 | $val = $key; |
61 | 61 | } |
62 | 62 | } |