@@ -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,10 +62,10 @@ 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 | - if(config('easy_panel.crud.'.$action.'.'.$key)){ |
|
| 68 | + if (config('easy_panel.crud.'.$action.'.'.$key)) { |
|
| 69 | 69 | return config('easy_panel.crud.'.$action.'.'.$key); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $str = ''; |
| 120 | 120 | foreach ($fields as $key => $field) { |
| 121 | - $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,"; |
|
| 121 | + $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,"; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $model = $this->getNameInput(); |
| 125 | - if(config("easy_panel.crud.$model.extra_values")){ |
|
| 125 | + if (config("easy_panel.crud.$model.extra_values")) { |
|
| 126 | 126 | $str .= $this->parseExtraValues(); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $str; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function parseExtraValues(){ |
|
| 132 | + public function parseExtraValues() { |
|
| 133 | 133 | $str = ''; |
| 134 | 134 | |
| 135 | 135 | $values = $this->getConfig('extra_values'); |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | $modelName = strtolower($modelName); |
| 148 | 148 | foreach ($fields as $value) { |
| 149 | 149 | if (!is_array($value)) { |
| 150 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
| 150 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
| 151 | 151 | } else { |
| 152 | 152 | $relationName = array_key_first($value); |
| 153 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
| 153 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $field = ucfirst($field); |
| 167 | 167 | } else { |
| 168 | 168 | $relationName = array_key_first($field); |
| 169 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
| 169 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
| 170 | 170 | } |
| 171 | 171 | $str .= "<td> $field </td>".$this->makeTab(6, end($fields) != $field); |
| 172 | 172 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $str .= '<div class="form-group">'.$this->makeTab(4); |
| 184 | 184 | $str .= '<label for="input'.$key.'" class="col-sm-2 control-label">'.ucfirst($key).'</label>'.$this->makeTab(4); |
| 185 | 185 | $str = $this->inputsHTML($type, $key, $str).$this->makeTab(4); |
| 186 | - $str .='@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3); |
|
| 186 | + $str .= '@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3); |
|
| 187 | 187 | $str .= '</div>'.$this->makeTab(3); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -194,19 +194,19 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | $mode = config('easy_panel.lazy_mode') ? 'wire:model.lazy' : 'wire:model'; |
| 196 | 196 | $array = [ |
| 197 | - 'text' => '<input type="text" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 198 | - 'email' => '<input type="email" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 199 | - 'number' => '<input type="number" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 200 | - 'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">', |
|
| 201 | - 'textarea' => '<textarea '.$mode.'="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
| 202 | - 'password' => '<input type="password" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
| 197 | + 'text' => '<input type="text" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 198 | + 'email' => '<input type="email" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 199 | + 'number' => '<input type="number" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 200 | + 'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">', |
|
| 201 | + 'textarea' => '<textarea '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
| 202 | + 'password' => '<input type="password" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
| 203 | 203 | ]; |
| 204 | 204 | $str .= $array[$type]; |
| 205 | 205 | |
| 206 | 206 | return $str; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function makeTab($count, $newLine = true){ |
|
| 209 | + public function makeTab($count, $newLine = true) { |
|
| 210 | 210 | $count = $count * 4; |
| 211 | 211 | $tabs = str_repeat(' ', $count); |
| 212 | 212 | |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(! function_exists('getRouteName')) |
|
| 3 | +if (!function_exists('getRouteName')) |
|
| 4 | 4 | { |
| 5 | - function getRouteName(){ |
|
| 5 | + function getRouteName() { |
|
| 6 | 6 | $routeName = config('easy_panel.route_prefix'); |
| 7 | 7 | $routeName = trim($routeName, '/'); |
| 8 | 8 | $routeName = str_replace('/', '.', $routeName); |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if(! function_exists('get_icon')) |
|
| 13 | +if (!function_exists('get_icon')) |
|
| 14 | 14 | { |
| 15 | - function get_icon($type){ |
|
| 15 | + function get_icon($type) { |
|
| 16 | 16 | $array = [ |
| 17 | 17 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
| 18 | 18 | 'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | 'music' => ['musics', 'music', 'audios', 'audio'], |
| 26 | 26 | 'bell' => ['notifications', 'notification'], |
| 27 | 27 | ]; |
| 28 | - foreach ($array as $key => $arrayValues){ |
|
| 29 | - if(in_array($type, $arrayValues)){ |
|
| 28 | + foreach ($array as $key => $arrayValues) { |
|
| 29 | + if (in_array($type, $arrayValues)) { |
|
| 30 | 30 | $val = $key; |
| 31 | 31 | } |
| 32 | 32 | } |