Passed
Push — master ( 507065...1bc56d )
by Reza
03:51
created
src/Commands/DeleteCRUD.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function handle()
17 17
     {
18 18
         $names = (array) $this->argument('name') ?: config('easy_panel.actions', []);
19
-        if($names == null) {
19
+        if ($names == null) {
20 20
             throw new CommandNotFoundException("There is no action in config file");
21 21
         }
22 22
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
             if ($this->askResult($name)) {
30 30
                 File::deleteDirectory(resource_path("/views/livewire/admin/$name"));
31
-                File::deleteDirectory(app_path("/Http/Livewire/Admin/" . ucfirst($name)));
31
+                File::deleteDirectory(app_path("/Http/Livewire/Admin/".ucfirst($name)));
32 32
                 $this->info("{$name} files were deleted, make sure you will delete {$name} value from actions in config");
33 33
             } else {
34 34
                 $this->line("process for {$name} action was canceled.");
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function askResult($name)
41 41
     {
42
-        if($this->option('force')) {
42
+        if ($this->option('force')) {
43 43
             return true;
44 44
         }
45 45
         $result = $this->confirm("Do you really want to delete {$name} files ?", true);
Please login to merge, or discard this patch.
src/Commands/Actions/StubParser.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         return str_replace(array_keys($array), array_values($array), $stub);
37 37
     }
38 38
 
39
-    public function parseBlade($stub){
39
+    public function parseBlade($stub) {
40 40
         $modelNamespace = $this->parseModel($this->getConfig('model'));
41 41
         $modelName = $this->getModelName($modelNamespace);
42 42
         $array = [
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         return $this->qualifyModel($model);
60 60
     }
61 61
 
62
-    public function getConfig($key, $action = null){
62
+    public function getConfig($key, $action = null) {
63 63
         $action = $action ?? $this->getNameInput();
64 64
 
65 65
         return config("easy_panel.crud.$action.$key") ?: [];
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $fields = array_keys($fields);
78 78
         $str = '';
79 79
 
80
-        if(in_array($this->getNameInput(), $fields)){
80
+        if (in_array($this->getNameInput(), $fields)) {
81 81
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
82 82
             die;
83 83
         }
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $str = '';
133 133
         foreach ($fields as $key => $field) {
134
-            $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,";
134
+            $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,";
135 135
         }
136 136
 
137 137
         $model = $this->getNameInput();
138
-        if(config("easy_panel.crud.$model.extra_values")){
138
+        if (config("easy_panel.crud.$model.extra_values")) {
139 139
             $str .= $this->parseExtraValues();
140 140
         }
141 141
 
142 142
         return $str;
143 143
     }
144 144
 
145
-    public function parseExtraValues(){
145
+    public function parseExtraValues() {
146 146
         $str = '';
147 147
 
148 148
         $values = $this->getConfig('extra_values');
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
         $modelName = strtolower($modelName);
161 161
         foreach ($fields as $value) {
162 162
             if (!is_array($value)) {
163
-                if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) {
164
-                    $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value);
163
+                if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) {
164
+                    $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value);
165 165
                 } else {
166
-                    $str .= '<td><a target="_blank" href="{{ asset($' . $modelName . '->' . $value . ') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($' . $modelName . '->' . $value . ') }}" alt="'.$value.'"></td></a>' . $this->makeTab(1, end($fields) != $value);
166
+                    $str .= '<td><a target="_blank" href="{{ asset($'.$modelName.'->'.$value.') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($'.$modelName.'->'.$value.') }}" alt="'.$value.'"></td></a>'.$this->makeTab(1, end($fields) != $value);
167 167
                 }
168 168
            } else {
169 169
                 $relationName = array_key_first($value);
170
-                $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value);
170
+                $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value);
171 171
             }
172 172
         }
173 173
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                 $field = ucfirst($field);
184 184
             } else {
185 185
                 $relationName = array_key_first($field);
186
-                $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]);
186
+                $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]);
187 187
             }
188 188
             $str .= "<td> $field </td>".$this->makeTab(6, end($fields) != $field);
189 189
         }
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $mode = config('easy_panel.lazy_mode') ? 'wire:model.lazy' : 'wire:model';
213 213
         $array = [
214
-            'text' => '<input type="text" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
215
-            'email' => '<input type="email" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
216
-            'number' => '<input type="number" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
217
-            'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">',
218
-            'textarea' => '<textarea '.$mode.'="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
219
-            'password' => '<input type="password" '. $mode .'="' . $key . '" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
220
-            'ckeditor' => '<div wire:ignore><textarea class="form-control ckeditor" id="editor" wire:model="'. $key .'"></textarea></div>'."<script>ClassicEditor.create(document.querySelector('#editor'), {}).then(editor => {editor.model.document.on('change:data', () => {@this.content = editor.getData()});});</script>",
214
+            'text' => '<input type="text" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
215
+            'email' => '<input type="email" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
216
+            'number' => '<input type="number" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
217
+            'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">',
218
+            'textarea' => '<textarea '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
219
+            'password' => '<input type="password" '.$mode.'="'.$key.'" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
220
+            'ckeditor' => '<div wire:ignore><textarea class="form-control ckeditor" id="editor" wire:model="'.$key.'"></textarea></div>'."<script>ClassicEditor.create(document.querySelector('#editor'), {}).then(editor => {editor.model.document.on('change:data', () => {@this.content = editor.getData()});});</script>",
221 221
         ];
222 222
         $str .= $array[$type];
223 223
 
224 224
         return $str;
225 225
     }
226 226
 
227
-    public function makeTab($count, $newLine = true){
227
+    public function makeTab($count, $newLine = true) {
228 228
         $count = $count * 4;
229 229
         $tabs = str_repeat(' ', $count);
230 230
 
Please login to merge, or discard this patch.