|
@@ -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,7 +120,7 @@ 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
|
return $str; |
|
@@ -158,7 +158,7 @@ discard block |
|
|
block discarded – undo |
|
158
|
158
|
foreach ($fields as $key => $type) { |
|
159
|
159
|
$str .= '<div class="form-group"><label for="input'.$key.'" class="col-sm-2 control-label">'.ucfirst($key).'</label>'.PHP_EOL; |
|
160
|
160
|
$str = $this->inputsHTML($type, $key, $str).PHP_EOL; |
|
161
|
|
- $str .='@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror</div>'.PHP_EOL; |
|
|
161
|
+ $str .= '@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror</div>'.PHP_EOL; |
|
162
|
162
|
} |
|
163
|
163
|
|
|
164
|
164
|
return $str; |
|
@@ -167,19 +167,19 @@ discard block |
|
|
block discarded – undo |
|
167
|
167
|
protected function inputsHTML($type, $key, string $str): string |
|
168
|
168
|
{ |
|
169
|
169
|
$array = [ |
|
170
|
|
- 'text' => '<input type="text" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL, |
|
171
|
|
- 'email' => '<input type="email" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL, |
|
172
|
|
- 'number' => '<input type="number" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL, |
|
173
|
|
- 'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '"">'.PHP_EOL, |
|
174
|
|
- 'textarea' => '<textarea wire:model="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>'.PHP_EOL, |
|
175
|
|
- 'password' => '<input type="password" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL, |
|
|
170
|
+ 'text' => '<input type="text" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL, |
|
|
171
|
+ 'email' => '<input type="email" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL, |
|
|
172
|
+ 'number' => '<input type="number" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL, |
|
|
173
|
+ 'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'"">'.PHP_EOL, |
|
|
174
|
+ 'textarea' => '<textarea wire:model="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>'.PHP_EOL, |
|
|
175
|
+ 'password' => '<input type="password" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL, |
|
176
|
176
|
]; |
|
177
|
177
|
$str .= $array[$type]; |
|
178
|
178
|
|
|
179
|
179
|
return $str; |
|
180
|
180
|
} |
|
181
|
181
|
|
|
182
|
|
- private function makeTab($count){ |
|
|
182
|
+ private function makeTab($count) { |
|
183
|
183
|
$count = $count * 4; |
|
184
|
184
|
$tabs = str_repeat(' ', $count); |
|
185
|
185
|
|