@@ -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,17 +11,17 @@ 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 | $namespace = "\\App\\CRUD\\{$name}Component"; |
17 | 17 | |
18 | - if (!class_exists($namespace)){ |
|
18 | + if (!class_exists($namespace)) { |
|
19 | 19 | abort(403, "Class with {$namespace} namespace doesn't exist"); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $instance = app()->make($namespace); |
23 | 23 | |
24 | - if (!$instance instanceof CRUDComponent){ |
|
24 | + if (!$instance instanceof CRUDComponent) { |
|
25 | 25 | abort(403, "{$namespace} should implement CRUDComponent interface"); |
26 | 26 | } |
27 | 27 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if(! function_exists('get_icon')) { |
|
33 | - function get_icon($type){ |
|
32 | +if (!function_exists('get_icon')) { |
|
33 | + function get_icon($type) { |
|
34 | 34 | $array = [ |
35 | 35 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
36 | 36 | 'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | 'truck' => ['product', 'products', 'shops', 'shop'], |
48 | 48 | 'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'], |
49 | 49 | ]; |
50 | - foreach ($array as $key => $arrayValues){ |
|
51 | - if(in_array($type, $arrayValues)){ |
|
50 | + foreach ($array as $key => $arrayValues) { |
|
51 | + if (in_array($type, $arrayValues)) { |
|
52 | 52 | $val = $key; |
53 | 53 | } |
54 | 54 | } |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | -if(! function_exists('registerActionRoutes')){ |
|
59 | +if (!function_exists('registerActionRoutes')) { |
|
60 | 60 | function registerActionRoutes($prefix, $component, $crudConfig) |
61 | 61 | { |
62 | - Route::prefix($prefix)->name("$prefix.")->group(function () use ($component, $crudConfig) { |
|
62 | + Route::prefix($prefix)->name("$prefix.")->group(function() use ($component, $crudConfig) { |
|
63 | 63 | |
64 | - if(@class_exists("$component\\Read")) { |
|
64 | + if (@class_exists("$component\\Read")) { |
|
65 | 65 | Route::get('/', "$component\\Read")->name('read'); |
66 | 66 | } |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if (@$crudConfig->update and @class_exists("$component\\Update")) { |
73 | - Route::get('/update/{' . $action . '}', "$component\\Update")->name('update'); |
|
73 | + Route::get('/update/{'.$action.'}', "$component\\Update")->name('update'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | }); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('cruds', function (Blueprint $table) { |
|
16 | + Schema::create('cruds', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->string('name')->unique(); |
19 | 19 | $table->string('model')->unique(); |