@@ -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,21 +11,21 @@ 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 | $className = ucwords($name); |
| 17 | 17 | $namespace = "\\App\\CRUD\\{$className}Component"; |
| 18 | 18 | $appFilePath = app_path("/CRUD/{$name}Component.php"); |
| 19 | 19 | $nsExist = class_exists($namespace); |
| 20 | 20 | $filePathExist = file_exists($appFilePath); |
| 21 | 21 | |
| 22 | - if (!$filePathExist or !$nsExist){ |
|
| 22 | + if (!$filePathExist or !$nsExist) { |
|
| 23 | 23 | abort(403, "Class with {$namespace} namespace or {$appFilePath} doesn't exist, "); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $instance = app()->make($namespace); |
| 27 | 27 | |
| 28 | - if (!$instance instanceof CRUDComponent){ |
|
| 28 | + if (!$instance instanceof CRUDComponent) { |
|
| 29 | 29 | abort(403, "{$namespace} should implement CRUDComponent interface"); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -if(! function_exists('crud')) { |
|
| 37 | - function crud($name){ |
|
| 36 | +if (!function_exists('crud')) { |
|
| 37 | + function crud($name) { |
|
| 38 | 38 | return \EasyPanel\Models\CRUD::query()->where('name', $name)->first(); |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -if (! function_exists('hasPermission')) { |
|
| 42 | +if (!function_exists('hasPermission')) { |
|
| 43 | 43 | function hasPermission($routeName, $withAcl, $withPolicy = false, $entity = []) { |
| 44 | 44 | $showButton = true; |
| 45 | 45 | |