@@ -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 (!file_exists(app_path("/CRUD/{$name}Component.php")) or !class_exists($namespace)){ |
|
| 18 | + if (!file_exists(app_path("/CRUD/{$name}Component.php")) or !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('crud')) { |
|
| 33 | - function crud($name){ |
|
| 32 | +if (!function_exists('crud')) { |
|
| 33 | + function crud($name) { |
|
| 34 | 34 | return \EasyPanel\Models\CRUD::query()->where('name', $name)->first(); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | ]); |
| 25 | 25 | |
| 26 | 26 | $this->crud->delete(); |
| 27 | - $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('CRUD') ] )]); |
|
| 27 | + $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('CRUD')])]); |
|
| 28 | 28 | $this->emit('crudUpdated'); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'built' => true |
| 40 | 40 | ]); |
| 41 | 41 | |
| 42 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully') ] ); |
|
| 42 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully')]); |
|
| 43 | 43 | $this->emit('crudUpdated'); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'active' => false |
| 50 | 50 | ]); |
| 51 | 51 | |
| 52 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated') ] ); |
|
| 52 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated')]); |
|
| 53 | 53 | $this->emit('crudUpdated'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | 'active' => true |
| 60 | 60 | ]); |
| 61 | 61 | |
| 62 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated') ] ); |
|
| 62 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated')]); |
|
| 63 | 63 | $this->emit('crudUpdated'); |
| 64 | 64 | } |
| 65 | 65 | |