Passed
Push — master ( 0c3872...7a99d2 )
by Reza
03:59
created
src/Http/Livewire/CRUD/Create.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $this->validate();
57 57
 
58
-        if (!class_exists($this->model) or ! app()->make($this->model) instanceof Model){
58
+        if (!class_exists($this->model) or !app()->make($this->model) instanceof Model) {
59 59
             $this->addError('model', __('Namespace is invalid'));
60 60
 
61 61
             return;
62 62
         }
63 63
 
64
-        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)){
64
+        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)) {
65 65
             $this->addError('route', __('Route is invalid'));
66 66
 
67 67
             return;
68 68
         }
69 69
 
70
-        try{
70
+        try {
71 71
             $name = strtolower($this->getModelName($this->model));
72 72
             CRUD::create([
73 73
                 'model' => trim($this->model, '\\'),
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
                 '--force' => true
81 81
             ]);
82 82
 
83
-            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD') ])]);
84
-        } catch(\Exception $exception){
85
-            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError') ]);
83
+            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD')])]);
84
+        } catch (\Exception $exception) {
85
+            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError')]);
86 86
         }
87 87
 
88 88
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             ->layout('admin::layouts.app');
97 97
     }
98 98
 
99
-    private function getModelName($model){
99
+    private function getModelName($model) {
100 100
         $model = explode('\\', $model);
101 101
 
102 102
         return end($model);
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
         $files = File::exists(app_path('/Models')) ? File::files(app_path('/Models')) : File::allFiles(app_path('/'));
108 108
         $array = [];
109 109
         foreach ($files as $file) {
110
-            if (!Str::contains($file->getFilename(), '.php') or (!is_null($query) and !Str::contains(Str::lower($file->getFilename()), Str::lower($query)))){
110
+            if (!Str::contains($file->getFilename(), '.php') or (!is_null($query) and !Str::contains(Str::lower($file->getFilename()), Str::lower($query)))) {
111 111
                 continue;
112 112
             }
113 113
 
114 114
             $namespace = File::exists(app_path('/Models')) ? "App\\Models" : "\\App";
115 115
             $fileName = str_replace('.php', null, $file->getFilename());
116
-            $fullNamespace =  $namespace."\\{$fileName}";
116
+            $fullNamespace = $namespace."\\{$fileName}";
117 117
 
118 118
             if (app()->make($fullNamespace) instanceof Model) {
119 119
                 $array[] = $fullNamespace;
Please login to merge, or discard this patch.
src/Commands/Actions/DeleteCRUD.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     {
18 18
         $names = (array) $this->argument('name') ?: CRUD::query()->where('active', true)->pluck('name')->toArray();
19 19
 
20
-        if($names == null) {
20
+        if ($names == null) {
21 21
             throw new CommandNotFoundException("There is no action in database");
22 22
         }
23 23
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
             if ($this->askResult($name)) {
31 31
                 File::deleteDirectory(resource_path("/views/livewire/admin/$name"));
32
-                File::deleteDirectory(app_path("/Http/Livewire/Admin/" . ucfirst($name)));
32
+                File::deleteDirectory(app_path("/Http/Livewire/Admin/".ucfirst($name)));
33 33
                 File::delete(app_path("/CRUD/".ucfirst($name)."Component.php"));
34 34
                 $this->info("{$name} files were deleted, make sure you will delete {$name} value from actions in config");
35 35
                 CRUD::query()->where('name', $name)->delete();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function askResult($name)
44 44
     {
45
-        if($this->option('force')) {
45
+        if ($this->option('force')) {
46 46
             return true;
47 47
         }
48 48
         $result = $this->confirm("Do you really want to delete {$name} files ?", true);
Please login to merge, or discard this patch.
src/Parsers/HTMLInputs/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
     public function handle($name, $values, $action)
9 9
     {
10 10
         return "<select wire:model='$name' class=\"form-control @error('$name') is-invalid @enderror\" id='input$name'>
11
-                @foreach(getCrudConfig('$action')->inputs()['$name']['select'] as " . '$key => $value' . ")
12
-                    <option value='{{ " . '$key' . " }}'>{{ " . '$value' . " }}</option>
11
+                @foreach(getCrudConfig('$action')->inputs()['$name']['select'] as ".'$key => $value'.")
12
+                    <option value='{{ " . '$key'." }}'>{{ ".'$value'." }}</option>
13 13
                 @endforeach
14 14
             </select>";
15 15
     }
Please login to merge, or discard this patch.
src/Parsers/StubParser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
         $this->store = $store;
36 36
     }
37 37
 
38
-    public function setAuthType(bool $hasAuth){
38
+    public function setAuthType(bool $hasAuth) {
39 39
         $this->hasAuth = $hasAuth;
40 40
     }
41 41
 
42
-    public function setFields(array $fields){
42
+    public function setFields(array $fields) {
43 43
         $this->fields = $fields;
44 44
     }
45 45
 
46
-    public function setInputs(array $inputs){
46
+    public function setInputs(array $inputs) {
47 47
         $this->inputs = $inputs;
48 48
     }
49 49
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $decodedFile = json_decode(File::get($file), 1);
80 80
             $texts = $this->texts;
81 81
             foreach ($texts as $key => $text) {
82
-                if (array_key_exists($key, $decodedFile)){
82
+                if (array_key_exists($key, $decodedFile)) {
83 83
                     unset($texts[$text]);
84 84
                 }
85 85
             }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $fields = array_keys($this->inputs);
107 107
         $str = '';
108 108
 
109
-        if(in_array($this->inputName, $fields)){
109
+        if (in_array($this->inputName, $fields)) {
110 110
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
111 111
             die;
112 112
         }
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 
178 178
         foreach ($this->inputs as $key => $field) {
179 179
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
180
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
180
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
181 181
         }
182 182
 
183
-        if($this->hasAuth){
183
+        if ($this->hasAuth) {
184 184
             $str .= "'user_id' => auth()->id(),";
185 185
         }
186 186
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     /**
191 191
      * Create Blade from stub
192 192
      */
193
-    public function parseBlade($stub){
193
+    public function parseBlade($stub) {
194 194
         $modelName = $this->getModelName($this->parsedModel);
195 195
 
196 196
         $array = [
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
         $modelName = strtolower($this->getModelName($this->parsedModel));
218 218
         foreach ($fields as $value) {
219 219
             if (!Str::contains($value, '.')) {
220
-                if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) {
221
-                    $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value);
220
+                if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) {
221
+                    $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value);
222 222
                 } else {
223
-                    $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.'"></a></td>' . $this->makeTab(1, end($fields) != $value);
223
+                    $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.'"></a></td>'.$this->makeTab(1, end($fields) != $value);
224 224
                 }
225 225
             } else {
226 226
                 $newValue = $this->parseDots($value);
227
-                $str .= '<td> {{ $' . $modelName . '->' . $newValue .' }} </td>' . $this->makeTab(1, end($fields) != $value);
227
+                $str .= '<td> {{ $'.$modelName.'->'.$newValue.' }} </td>'.$this->makeTab(1, end($fields) != $value);
228 228
             }
229 229
         }
230 230
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     /**
272 272
      * Tab Maker (Each tabs mean 4 space)
273 273
      */
274
-    public function makeTab($count, $newLine = true){
274
+    public function makeTab($count, $newLine = true) {
275 275
         $count = $count * 4;
276 276
         $tabs = str_repeat(' ', $count);
277 277
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     {
288 288
         $array = explode('.', $field);
289 289
         $str = '';
290
-        foreach ($array as $value){
290
+        foreach ($array as $value) {
291 291
             $str .= ucfirst($value)." ";
292 292
         }
293 293
 
Please login to merge, or discard this patch.