|
@@ -39,7 +39,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
|