@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | $this->store = $store; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setAuthType(bool $hasAuth){ |
|
| 41 | + public function setAuthType(bool $hasAuth) { |
|
| 42 | 42 | $this->hasAuth = $hasAuth; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function setFields(array $fields){ |
|
| 45 | + public function setFields(array $fields) { |
|
| 46 | 46 | $this->fields = $fields; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setInputs(array $inputs){ |
|
| 49 | + public function setInputs(array $inputs) { |
|
| 50 | 50 | $this->inputs = $inputs; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $fields = array_keys($this->inputs); |
| 99 | 99 | $str = ''; |
| 100 | 100 | |
| 101 | - if(in_array($this->inputName, $fields)){ |
|
| 101 | + if (in_array($this->inputName, $fields)) { |
|
| 102 | 102 | $this->error("Model name must not equal to column names, fix it and rerun command with -f flag"); |
| 103 | 103 | die; |
| 104 | 104 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $str = ''; |
| 119 | 119 | foreach ($this->inputs as $key => $input) { |
| 120 | 120 | $inputObject = $this->normalizeInput($key, $input); |
| 121 | - if (! $inputObject instanceof File){ |
|
| 121 | + if (!$inputObject instanceof File) { |
|
| 122 | 122 | continue; |
| 123 | 123 | } |
| 124 | 124 | // We get store path which has been defined in crud's config file |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | foreach ($this->inputs as $key => $field) { |
| 176 | 176 | $newLine = ($field != end($this->inputs) or $this->hasAuth); |
| 177 | - $str .= "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine); |
|
| 177 | + $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if($this->hasAuth){ |
|
| 180 | + if ($this->hasAuth) { |
|
| 181 | 181 | $str .= "'user_id' => auth()->id(),"; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | /** |
| 188 | 188 | * Create Blade from stub |
| 189 | 189 | */ |
| 190 | - public function parseBlade($stub){ |
|
| 190 | + public function parseBlade($stub) { |
|
| 191 | 191 | $modelName = $this->getModelName($this->parsedModel); |
| 192 | 192 | |
| 193 | 193 | $crud = crud(strtolower($modelName)); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | /** |
| 271 | 271 | * Tab Maker (Each tabs mean 4 space) |
| 272 | 272 | */ |
| 273 | - public function makeTab($count, $newLine = true){ |
|
| 273 | + public function makeTab($count, $newLine = true) { |
|
| 274 | 274 | $count = $count * 4; |
| 275 | 275 | $tabs = str_repeat(' ', $count); |
| 276 | 276 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | public function normalizeField($field) |
| 288 | 288 | { |
| 289 | - if($field instanceof Field){ |
|
| 289 | + if ($field instanceof Field) { |
|
| 290 | 290 | return $field; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | return Field::title($title); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - public function normalizeInput($key, $input){ |
|
| 299 | - if ($input instanceof BaseInput){ |
|
| 298 | + public function normalizeInput($key, $input) { |
|
| 299 | + if ($input instanceof BaseInput) { |
|
| 300 | 300 | return $input; |
| 301 | 301 | } |
| 302 | 302 | |
@@ -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 | |