|
@@ -21,7 +21,7 @@ discard block |
|
|
block discarded – undo |
|
21
|
21
|
protected function replaceModel($stub) |
|
22
|
22
|
{ |
|
23
|
23
|
$fields = $this->getConfig('fields'); |
|
24
|
|
- if(!$fields) { |
|
|
24
|
+ if (!$fields) { |
|
25
|
25
|
throw new CommandNotFoundException("There is no `field` in your config file"); |
|
26
|
26
|
} |
|
27
|
27
|
|
|
@@ -41,7 +41,7 @@ discard block |
|
|
block discarded – undo |
|
41
|
41
|
return str_replace(array_keys($array), array_values($array), $stub); |
|
42
|
42
|
} |
|
43
|
43
|
|
|
44
|
|
- protected function parseBlade($stub){ |
|
|
44
|
+ protected function parseBlade($stub) { |
|
45
|
45
|
$modelNamespace = $this->parseModel($this->getConfig('model')); |
|
46
|
46
|
$modelName = $this->getModelName($modelNamespace); |
|
47
|
47
|
$array = [ |
|
@@ -64,10 +64,10 @@ discard block |
|
|
block discarded – undo |
|
64
|
64
|
return $this->qualifyModel($model); |
|
65
|
65
|
} |
|
66
|
66
|
|
|
67
|
|
- protected function getConfig($key){ |
|
|
67
|
+ protected function getConfig($key) { |
|
68
|
68
|
$action = $this->getNameInput(); |
|
69
|
69
|
|
|
70
|
|
- if(config('easy_panel.actions.'.$action.'.'.$key)){ |
|
|
70
|
+ if (config('easy_panel.actions.'.$action.'.'.$key)) { |
|
71
|
71
|
return config('easy_panel.actions.'.$action.'.'.$key); |
|
72
|
72
|
} |
|
73
|
73
|
|
|
@@ -120,11 +120,11 @@ discard block |
|
|
block discarded – undo |
|
120
|
120
|
{ |
|
121
|
121
|
$str = ''; |
|
122
|
122
|
foreach ($fields as $key => $field) { |
|
123
|
|
- $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,"; |
|
|
123
|
+ $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,"; |
|
124
|
124
|
} |
|
125
|
125
|
|
|
126
|
126
|
$model = $this->getNameInput(); |
|
127
|
|
- if(config("easy_panel.actions.$model.extra_values")){ |
|
|
127
|
+ if (config("easy_panel.actions.$model.extra_values")) { |
|
128
|
128
|
|
|
129
|
129
|
$str .= $this->parseExtraValues(); |
|
130
|
130
|
} |
|
@@ -132,7 +132,7 @@ discard block |
|
|
block discarded – undo |
|
132
|
132
|
return $str; |
|
133
|
133
|
} |
|
134
|
134
|
|
|
135
|
|
- protected function parseExtraValues(){ |
|
|
135
|
+ protected function parseExtraValues() { |
|
136
|
136
|
$str = ''; |
|
137
|
137
|
|
|
138
|
138
|
foreach ($this->getConfig('extra_values') as $key => $value) { |
|
@@ -175,7 +175,7 @@ discard block |
|
|
block discarded – undo |
|
175
|
175
|
$str .= '<div class="form-group">'.$this->makeTab(4); |
|
176
|
176
|
$str .= '<label for="input'.$key.'" class="col-sm-2 control-label">'.ucfirst($key).'</label>'.$this->makeTab(4); |
|
177
|
177
|
$str = $this->inputsHTML($type, $key, $str).$this->makeTab(4); |
|
178
|
|
- $str .='@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3); |
|
|
178
|
+ $str .= '@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3); |
|
179
|
179
|
$str .= '</div>'.$this->makeTab(3); |
|
180
|
180
|
} |
|
181
|
181
|
|
|
@@ -185,19 +185,19 @@ discard block |
|
|
block discarded – undo |
|
185
|
185
|
protected function inputsHTML($type, $key, string $str): string |
|
186
|
186
|
{ |
|
187
|
187
|
$array = [ |
|
188
|
|
- 'text' => '<input type="text" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
189
|
|
- 'email' => '<input type="email" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
190
|
|
- 'number' => '<input type="number" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
191
|
|
- 'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">', |
|
192
|
|
- 'textarea' => '<textarea wire:model="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
193
|
|
- 'password' => '<input type="password" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">', |
|
|
188
|
+ 'text' => '<input type="text" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
|
189
|
+ 'email' => '<input type="email" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
|
190
|
+ 'number' => '<input type="number" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
|
191
|
+ 'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">', |
|
|
192
|
+ 'textarea' => '<textarea wire:model="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>', |
|
|
193
|
+ 'password' => '<input type="password" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">', |
|
194
|
194
|
]; |
|
195
|
195
|
$str .= $array[$type]; |
|
196
|
196
|
|
|
197
|
197
|
return $str; |
|
198
|
198
|
} |
|
199
|
199
|
|
|
200
|
|
- private function makeTab($count){ |
|
|
200
|
+ private function makeTab($count) { |
|
201
|
201
|
$count = $count * 4; |
|
202
|
202
|
$tabs = str_repeat(' ', $count); |
|
203
|
203
|
|