@@ -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 |
@@ -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"); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function boot() |
46 | 46 | { |
47 | - if(!config('easy_panel.enable')) { |
|
47 | + if (!config('easy_panel.enable')) { |
|
48 | 48 | return; |
49 | 49 | } |
50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Load Views |
56 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
56 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
57 | 57 | |
58 | 58 | // Register Middleware |
59 | 59 | $this->registerMiddlewareAlias(); |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | |
68 | 68 | private function defineRoutes() |
69 | 69 | { |
70 | - if(!$this->app->routesAreCached()) { |
|
70 | + if (!$this->app->routesAreCached()) { |
|
71 | 71 | Route::prefix(config('easy_panel.route_prefix')) |
72 | 72 | ->middleware(['web', 'auth', 'isAdmin']) |
73 | - ->name(getRouteName() . '.') |
|
74 | - ->group(__DIR__ . '/routes.php'); |
|
73 | + ->name(getRouteName().'.') |
|
74 | + ->group(__DIR__.'/routes.php'); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | |
97 | 97 | private function mergePublishes() |
98 | 98 | { |
99 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
99 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
100 | 100 | |
101 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
101 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
102 | 102 | |
103 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
103 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
104 | 104 | |
105 | - $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'); |
|
105 | + $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 | 106 | |
107 | 107 | $this->publishes([__DIR__.'/../resources/cruds' => resource_path('/cruds')], 'easy-panel-cruds'); |
108 | 108 | } |