@@ -15,10 +15,9 @@ |
||
15 | 15 | public function handle() |
16 | 16 | { |
17 | 17 | $names = $this->argument('name') ? |
18 | - [$this->argument('name')] : |
|
19 | - CRUD::query()->where('active', true)->pluck('name')->toArray(); |
|
18 | + [$this->argument('name')] : CRUD::query()->where('active', true)->pluck('name')->toArray(); |
|
20 | 19 | |
21 | - if(is_null($names)) { |
|
20 | + if (is_null($names)) { |
|
22 | 21 | throw new CommandNotFoundException("There is no action in config file"); |
23 | 22 | } |
24 | 23 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $path = base_path("app/CRUD/{$name}Component.php"); |
26 | 26 | |
27 | - if($this->files->exists($path) and !$this->option('force')){ |
|
27 | + if ($this->files->exists($path) and !$this->option('force')) { |
|
28 | 28 | $this->warn("'{$name}.php' already exists in CRUDs config"); |
29 | 29 | return; |
30 | 30 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $model = $this->qualifyModel($this->getNameInput()); |
63 | 63 | |
64 | - if(!class_exists($model)){ |
|
64 | + if (!class_exists($model)) { |
|
65 | 65 | $this->warn("Model option should be valid and model should be exist"); |
66 | 66 | die(); |
67 | 67 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | private function withAuth() |
73 | 73 | { |
74 | 74 | $fillableList = $this->getFillableList(); |
75 | - if(!in_array('user_id', $fillableList)){ |
|
75 | + if (!in_array('user_id', $fillableList)) { |
|
76 | 76 | return 'true'; |
77 | 77 | } |
78 | 78 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | { |
91 | 91 | $fillableList = $this->getFillableList(); |
92 | 92 | $array = []; |
93 | - foreach ($fillableList as $fillable){ |
|
94 | - if(!Str::contains($fillable, 'id')){ |
|
93 | + foreach ($fillableList as $fillable) { |
|
94 | + if (!Str::contains($fillable, 'id')) { |
|
95 | 95 | $array[] = "'$fillable'"; |
96 | 96 | } |
97 | 97 | } |
@@ -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(); |