@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | $admins = UserProviderFacade::getAdmins(); |
20 | 20 | $this->warn('Admin Lists :'); |
21 | - foreach ($admins as $admin){ |
|
21 | + foreach ($admins as $admin) { |
|
22 | 22 | $this->warn("• {$admin->name}: {$admin->email}"); |
23 | 23 | } |
24 | 24 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(! function_exists('getRouteName')) { |
|
4 | - function getRouteName(){ |
|
3 | +if (!function_exists('getRouteName')) { |
|
4 | + function getRouteName() { |
|
5 | 5 | $routeName = config('easy_panel.route_prefix'); |
6 | 6 | $routeName = trim($routeName, '/'); |
7 | 7 | $routeName = str_replace('/', '.', $routeName); |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | } |
10 | 10 | } |
11 | 11 | |
12 | -if(! function_exists('get_icon')) { |
|
13 | - function get_icon($type){ |
|
12 | +if (!function_exists('get_icon')) { |
|
13 | + function get_icon($type) { |
|
14 | 14 | $array = [ |
15 | 15 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
16 | 16 | 'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | 'music' => ['musics', 'music', 'audios', 'audio'], |
24 | 24 | 'bell' => ['notifications', 'notification'], |
25 | 25 | ]; |
26 | - foreach ($array as $key => $arrayValues){ |
|
27 | - if(in_array($type, $arrayValues)){ |
|
26 | + foreach ($array as $key => $arrayValues) { |
|
27 | + if (in_array($type, $arrayValues)) { |
|
28 | 28 | $val = $key; |
29 | 29 | } |
30 | 30 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if(! function_exists('registerActionRoutes')){ |
|
35 | +if (!function_exists('registerActionRoutes')) { |
|
36 | 36 | function registerActionRoutes($action, $component, $crudConfig) |
37 | 37 | { |
38 | - Route::prefix($action)->name("$action.")->group(function () use ($component, $crudConfig, $action) { |
|
38 | + Route::prefix($action)->name("$action.")->group(function() use ($component, $crudConfig, $action) { |
|
39 | 39 | |
40 | - if(@class_exists("$component\\Read")) { |
|
40 | + if (@class_exists("$component\\Read")) { |
|
41 | 41 | Route::get('/', "$component\\Read")->name('read'); |
42 | 42 | } |
43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | if (@$crudConfig['update'] and @class_exists("$component\\Update")) { |
49 | - Route::get('/update/{' . $action . '}', "$component\\Update")->name('update'); |
|
49 | + Route::get('/update/{'.$action.'}', "$component\\Update")->name('update'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | }); |
@@ -159,7 +159,7 @@ |
||
159 | 159 | } else { |
160 | 160 | $str .= '<td><a target="_blank" href="{{ asset($' . $modelName . '->' . $value . ') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($' . $modelName . '->' . $value . ') }}" alt="'.$value.'"></td></a>' . $this->makeTab(1, end($fields) != $value); |
161 | 161 | } |
162 | - } else { |
|
162 | + } else { |
|
163 | 163 | $relationName = array_key_first($value); |
164 | 164 | $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
165 | 165 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | return str_replace(array_keys($array), array_values($array), $stub); |
37 | 37 | } |
38 | 38 | |
39 | - public function parseBlade($stub){ |
|
39 | + public function parseBlade($stub) { |
|
40 | 40 | $modelNamespace = $this->parseModel($this->getConfig('model')); |
41 | 41 | $modelName = $this->getModelName($modelNamespace); |
42 | 42 | $array = [ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | return $this->qualifyModel($model); |
60 | 60 | } |
61 | 61 | |
62 | - public function getConfig($key, $action = null){ |
|
62 | + public function getConfig($key, $action = null) { |
|
63 | 63 | $action = $action ?? $this->getNameInput(); |
64 | 64 | |
65 | 65 | return config("easy_panel.crud.$action.$key") ?: []; |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | { |
126 | 126 | $str = ''; |
127 | 127 | foreach ($fields as $key => $field) { |
128 | - $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,"; |
|
128 | + $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,"; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $model = $this->getNameInput(); |
132 | - if(config("easy_panel.crud.$model.extra_values")){ |
|
132 | + if (config("easy_panel.crud.$model.extra_values")) { |
|
133 | 133 | $str .= $this->parseExtraValues(); |
134 | 134 | } |
135 | 135 | |
136 | 136 | return $str; |
137 | 137 | } |
138 | 138 | |
139 | - public function parseExtraValues(){ |
|
139 | + public function parseExtraValues() { |
|
140 | 140 | $str = ''; |
141 | 141 | |
142 | 142 | $values = $this->getConfig('extra_values'); |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | $modelName = strtolower($modelName); |
155 | 155 | foreach ($fields as $value) { |
156 | 156 | if (!is_array($value)) { |
157 | - if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
158 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
157 | + if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
158 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
159 | 159 | } else { |
160 | - $str .= '<td><a target="_blank" href="{{ asset($' . $modelName . '->' . $value . ') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($' . $modelName . '->' . $value . ') }}" alt="'.$value.'"></td></a>' . $this->makeTab(1, end($fields) != $value); |
|
160 | + $str .= '<td><a target="_blank" href="{{ asset($'.$modelName.'->'.$value.') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($'.$modelName.'->'.$value.') }}" alt="'.$value.'"></td></a>'.$this->makeTab(1, end($fields) != $value); |
|
161 | 161 | } |
162 | 162 | } else { |
163 | 163 | $relationName = array_key_first($value); |
164 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
164 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $field = ucfirst($field); |
178 | 178 | } else { |
179 | 179 | $relationName = array_key_first($field); |
180 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
180 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
181 | 181 | } |
182 | 182 | $str .= "<td> $field </td>".$this->makeTab(6, end($fields) != $field); |
183 | 183 | } |
@@ -205,19 +205,19 @@ discard block |
||
205 | 205 | { |
206 | 206 | $mode = config('easy_panel.lazy_mode') ? 'wire:model.lazy' : 'wire:model'; |
207 | 207 | $array = [ |
208 | - 'text' => '<input type="text" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
209 | - 'email' => '<input type="email" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
210 | - 'number' => '<input type="number" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
211 | - 'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">', |
|
212 | - 'textarea' => '<textarea '.$mode.'="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
213 | - 'password' => '<input type="password" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
208 | + 'text' => '<input type="text" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
209 | + 'email' => '<input type="email" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
210 | + 'number' => '<input type="number" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
211 | + 'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">', |
|
212 | + 'textarea' => '<textarea '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
213 | + 'password' => '<input type="password" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
214 | 214 | ]; |
215 | 215 | $str .= $array[$type]; |
216 | 216 | |
217 | 217 | return $str; |
218 | 218 | } |
219 | 219 | |
220 | - public function makeTab($count, $newLine = true){ |
|
220 | + public function makeTab($count, $newLine = true) { |
|
221 | 221 | $count = $count * 4; |
222 | 222 | $tabs = str_repeat(' ', $count); |
223 | 223 |