@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | public function register() |
| 27 | 27 | { |
| 28 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
| 29 | - if(!config('easy_panel.enable')) { |
|
| 28 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
| 29 | + if (!config('easy_panel.enable')) { |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $this->bindCommands(); |
| 35 | 35 | |
| 36 | 36 | foreach (config('easy_panel.actions') as $action) { |
| 37 | - if(!File::exists(resource_path("cruds/$action.php"))) { |
|
| 37 | + if (!File::exists(resource_path("cruds/$action.php"))) { |
|
| 38 | 38 | continue; |
| 39 | 39 | } |
| 40 | 40 | $data = require resource_path("cruds/$action.php"); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function boot() |
| 47 | 47 | { |
| 48 | - if(!config('easy_panel.enable')) { |
|
| 48 | + if (!config('easy_panel.enable')) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Load Views |
| 57 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
| 57 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
| 58 | 58 | |
| 59 | 59 | // Register Middleware |
| 60 | 60 | $this->registerMiddlewareAlias(); |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | private function defineRoutes() |
| 70 | 70 | { |
| 71 | - if(!$this->app->routesAreCached()) { |
|
| 71 | + if (!$this->app->routesAreCached()) { |
|
| 72 | 72 | Route::prefix(config('easy_panel.route_prefix')) |
| 73 | 73 | ->middleware(['web', 'auth', 'isAdmin']) |
| 74 | - ->name(getRouteName() . '.') |
|
| 75 | - ->group(__DIR__ . '/routes.php'); |
|
| 74 | + ->name(getRouteName().'.') |
|
| 75 | + ->group(__DIR__.'/routes.php'); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | private function mergePublishes() |
| 99 | 99 | { |
| 100 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
| 100 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
| 101 | 101 | |
| 102 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
| 102 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
| 103 | 103 | |
| 104 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__ . '/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles'); |
|
| 104 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__.'/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles'); |
|
| 105 | 105 | |
| 106 | - $this->publishes([__DIR__ . '/../database/migrations/2020_09_05_99999_create_todos_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_99999_create_admin_todos_table.php')], 'easy-panel-migrations'); |
|
| 106 | + $this->publishes([__DIR__.'/../database/migrations/2020_09_05_99999_create_todos_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_99999_create_admin_todos_table.php')], 'easy-panel-migrations'); |
|
| 107 | 107 | |
| 108 | 108 | $this->publishes([__DIR__.'/../resources/cruds' => resource_path('/cruds')], 'easy-panel-cruds'); |
| 109 | 109 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | return str_replace(array_keys($array), array_values($array), $stub); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function parseBlade($stub){ |
|
| 42 | + public function parseBlade($stub) { |
|
| 43 | 43 | $modelNamespace = $this->parseModel($this->getConfig('model')); |
| 44 | 44 | $modelName = $this->getModelName($modelNamespace); |
| 45 | 45 | $array = [ |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | return $this->qualifyModel($model); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function getConfig($key, $action = null){ |
|
| 65 | + public function getConfig($key, $action = null) { |
|
| 66 | 66 | $action = $action ?? $this->getNameInput(); |
| 67 | 67 | |
| 68 | 68 | return config("easy_panel.crud.$action.$key") ?: []; |
@@ -114,18 +114,18 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $str = ''; |
| 116 | 116 | foreach ($fields as $key => $field) { |
| 117 | - $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,"; |
|
| 117 | + $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,"; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $model = $this->getNameInput(); |
| 121 | - if(config("easy_panel.crud.$model.extra_values")){ |
|
| 121 | + if (config("easy_panel.crud.$model.extra_values")) { |
|
| 122 | 122 | $str .= $this->parseExtraValues(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $str; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function parseExtraValues(){ |
|
| 128 | + public function parseExtraValues() { |
|
| 129 | 129 | $str = ''; |
| 130 | 130 | |
| 131 | 131 | $values = $this->getConfig('extra_values'); |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | $modelName = strtolower($modelName); |
| 144 | 144 | foreach ($fields as $value) { |
| 145 | 145 | if (!is_array($value)) { |
| 146 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
| 146 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
| 147 | 147 | } else { |
| 148 | 148 | $relationName = array_key_first($value); |
| 149 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
| 149 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $field = ucfirst($field); |
| 163 | 163 | } else { |
| 164 | 164 | $relationName = array_key_first($field); |
| 165 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
| 165 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
| 166 | 166 | } |
| 167 | 167 | $str .= "<td> $field </td>".$this->makeTab(6, end($fields) != $field); |
| 168 | 168 | } |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | { |
| 191 | 191 | $mode = config('easy_panel.lazy_mode') ? 'wire:model.lazy' : 'wire:model'; |
| 192 | 192 | $array = [ |
| 193 | - 'text' => '<input type="text" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 194 | - 'email' => '<input type="email" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 195 | - 'number' => '<input type="number" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 196 | - 'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">', |
|
| 197 | - 'textarea' => '<textarea '.$mode.'="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
| 198 | - 'password' => '<input type="password" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 193 | + 'text' => '<input type="text" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 194 | + 'email' => '<input type="email" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 195 | + 'number' => '<input type="number" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 196 | + 'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">', |
|
| 197 | + 'textarea' => '<textarea '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
| 198 | + 'password' => '<input type="password" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 199 | 199 | ]; |
| 200 | 200 | $str .= $array[$type]; |
| 201 | 201 | |
| 202 | 202 | return $str; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - public function makeTab($count, $newLine = true){ |
|
| 205 | + public function makeTab($count, $newLine = true) { |
|
| 206 | 206 | $count = $count * 4; |
| 207 | 207 | $tabs = str_repeat(' ', $count); |
| 208 | 208 | |