Passed
Push — master ( 805b51...74bc3f )
by Reza
02:50
created
src/Commands/Actions/StubParser.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -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,10 +62,10 @@  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
-        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
 block discarded – undo
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
 block discarded – undo
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 = $this->parseRelationName(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
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             $str .= '<div class="form-group">'.$this->makeTab(4);
183 183
             $str .= '<label for="input'.$key.'" class="col-sm-2 control-label">'.ucfirst($key).'</label>'.$this->makeTab(4);
184 184
             $str = $this->inputsHTML($type, $key, $str).$this->makeTab(4);
185
-            $str .='@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3);
185
+            $str .= '@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3);
186 186
             $str .= '</div>'.$this->makeTab(3);
187 187
         }
188 188
 
@@ -192,28 +192,28 @@  discard block
 block discarded – undo
192 192
     public function inputsHTML($type, $key, string $str): string
193 193
     {
194 194
         $array = [
195
-            'text' => '<input type="text" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
196
-            'email' => '<input type="email" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
197
-            'number' => '<input type="number" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
198
-            'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">',
199
-            'textarea' => '<textarea wire:model="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
200
-            'password' => '<input type="password" wire:model.lazy="' . $key . '" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
195
+            'text' => '<input type="text" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
196
+            'email' => '<input type="email" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
197
+            'number' => '<input type="number" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
198
+            'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">',
199
+            'textarea' => '<textarea wire:model="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
200
+            'password' => '<input type="password" wire:model.lazy="'.$key.'" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
201 201
         ];
202 202
         $str .= $array[$type];
203 203
 
204 204
         return $str;
205 205
     }
206 206
 
207
-    public function makeTab($count, $newLine = true){
207
+    public function makeTab($count, $newLine = true) {
208 208
         $count = $count * 4;
209 209
         $tabs = str_repeat(' ', $count);
210 210
 
211 211
         return $newLine ? "\n".$tabs : $tabs;
212 212
     }
213 213
 
214
-    public function parseRelationName($column){
214
+    public function parseRelationName($column) {
215 215
         $relations = $this->getConfig('relations');
216
-        if(array_key_exists($column, $relations)){
216
+        if (array_key_exists($column, $relations)) {
217 217
             return $relations[$column];
218 218
         }
219 219
 
Please login to merge, or discard this patch.