Passed
Push — master ( ec9015...97207f )
by Reza
04:10
created
src/Commands/DeleteAdmin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     {
19 19
         $user = $this->argument('user');
20 20
 
21
-        if($this->askResult($user)){
21
+        if ($this->askResult($user)) {
22 22
             UserProviderFacade::deleteAdmin($user);
23 23
             $this->info('Admin was removed successfully');
24 24
         } else {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function askResult($user)
30 30
     {
31
-        if($this->option('force')) {
31
+        if ($this->option('force')) {
32 32
             return true;
33 33
         }
34 34
         $result = $this->confirm("Do you want to remove {$user} from administration", 'yes');
Please login to merge, or discard this patch.
src/Commands/Actions/CommandParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
 
26 26
     protected function getStub()
27 27
     {
28
-        return __DIR__ . "/../stub/{$this->file}.stub";
28
+        return __DIR__."/../stub/{$this->file}.stub";
29 29
     }
30 30
 
31 31
     private function buildBlade()
32 32
     {
33
-        $stub = $this->files->get(__DIR__ . "/../stub/blade/{$this->file}.blade.stub");
33
+        $stub = $this->files->get(__DIR__."/../stub/blade/{$this->file}.blade.stub");
34 34
         $newStub = $this->parseBlade($stub);
35 35
 
36 36
         $path = $this->viewPath("livewire/admin/{$this->getNameInput()}/{$this->file}.blade.php");
37 37
 
38
-        if (! $this->files->isDirectory(dirname($path))) {
38
+        if (!$this->files->isDirectory(dirname($path))) {
39 39
             $this->files->makeDirectory(dirname($path), 0755, true);
40 40
         }
41 41
 
Please login to merge, or discard this patch.
src/Commands/MakeAdmin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
     public function handle()
18 18
     {
19 19
         $user = $this->argument('user');
20
-        try{
20
+        try {
21 21
             UserProviderFacade::makeAdmin($user);
22 22
             $this->info("User {$user} was converted to an admin");
23
-        } catch (\Exception $exception){
23
+        } catch (\Exception $exception) {
24 24
             $this->error("User {$user} does not exist");
25 25
         }
26 26
     }
Please login to merge, or discard this patch.
src/Http/Middleware/isAdmin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
     public function handle($request, Closure $next)
14 14
     {
15
-        if(AuthFacade::checkIsAdmin(auth()->user()->id)){
15
+        if (AuthFacade::checkIsAdmin(auth()->user()->id)) {
16 16
             return $next($request);
17 17
         }
18 18
 
Please login to merge, or discard this patch.
database/migrations/2020_09_05_99999_create_todos_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('todos', function (Blueprint $table) {
16
+        Schema::create('todos', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->unsignedBigInteger('user_id');
19 19
             $table->string('title');
Please login to merge, or discard this patch.
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 run panel:crud to create files again");
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 ?", 'yes');
Please login to merge, or discard this patch.
src/Commands/MakeCRUD.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
     public function handle()
16 16
     {
17 17
         $names = $this->argument('name') ? [$this->argument('name')] : config('easy_panel.actions', []);
18
-        if($names == null) {
18
+        if ($names == null) {
19 19
             throw new CommandNotFoundException("There is no action in config file");
20 20
         }
21 21
         foreach ($names as $name) {
22
-            $config = config('easy_panel.crud.' . $name);
22
+            $config = config('easy_panel.crud.'.$name);
23 23
             if (!$config) {
24 24
                 throw new CommandNotFoundException("There is no {$name} in config file");
25 25
             }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $model = explode('\\', $model);
48 48
         $model = strtolower(end($model));
49 49
 
50
-        if($model != $name){
50
+        if ($model != $name) {
51 51
             throw new CommandNotFoundException("Action key should be equal to model name, You are using {$name} as key name but your model name is {$model}");
52 52
         }
53 53
     }
Please login to merge, or discard this patch.
src/Commands/MakeCRUDConfig.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function handle()
23 23
     {
24
-        if(!$this->option()){
24
+        if (!$this->option()) {
25 25
             $this->info("model option must have a value");
26 26
             return;
27 27
         }
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 
34 34
         $path = resource_path("cruds/{$name}.php");
35 35
 
36
-        if (! $this->files->isDirectory(dirname($path))) {
36
+        if (!$this->files->isDirectory(dirname($path))) {
37 37
             $this->files->makeDirectory(dirname($path), 0755, true);
38 38
         }
39 39
 
40
-        if($this->files->exists($path) and !$this->option('force')){
40
+        if ($this->files->exists($path) and !$this->option('force')) {
41 41
             $this->warn("'{$name}' exists in CRUDs config");
42 42
             return;
43 43
         }
44 44
 
45
-        if($name != strtolower($this->option('model'))){
45
+        if ($name != strtolower($this->option('model'))) {
46 46
             $this->warn("'{$name}' must be equal to model name");
47 47
             return;
48 48
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $model = $this->qualifyModel($this->option('model'));
57 57
 
58
-        if(!class_exists($model)){
58
+        if (!class_exists($model)) {
59 59
             $this->warn("Model option should be valid and model should be exist");
60 60
             die();
61 61
         }
Please login to merge, or discard this patch.
src/Commands/Actions/StubParser.php 1 patch
Spacing   +15 added lines, -15 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,7 +62,7 @@  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 68
         return config("easy_panel.crud.$action.$key") ?: [];
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $str = '';
116 116
         foreach ($fields as $key => $field) {
117
-            $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,";
117
+            $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,";
118 118
         }
119 119
 
120 120
         $model = $this->getNameInput();
121
-        if(config("easy_panel.crud.$model.extra_values")){
121
+        if (config("easy_panel.crud.$model.extra_values")) {
122 122
             $str .= $this->parseExtraValues();
123 123
         }
124 124
 
125 125
         return $str;
126 126
     }
127 127
 
128
-    public function parseExtraValues(){
128
+    public function parseExtraValues() {
129 129
         $str = '';
130 130
 
131 131
         $values = $this->getConfig('extra_values');
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
         $modelName = strtolower($modelName);
144 144
         foreach ($fields as $value) {
145 145
             if (!is_array($value)) {
146
-                $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value);
146
+                $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value);
147 147
             } else {
148 148
                 $relationName = array_key_first($value);
149
-                $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value);
149
+                $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value);
150 150
             }
151 151
         }
152 152
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 $field = ucfirst($field);
163 163
             } else {
164 164
                 $relationName = array_key_first($field);
165
-                $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]);
165
+                $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]);
166 166
             }
167 167
             $str .= "<td> $field </td>".$this->makeTab(6, end($fields) != $field);
168 168
         }
@@ -190,19 +190,19 @@  discard block
 block discarded – undo
190 190
     {
191 191
         $mode = config('easy_panel.lazy_mode') ? 'wire:model.lazy' : 'wire:model';
192 192
         $array = [
193
-            'text' => '<input type="text" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
194
-            'email' => '<input type="email" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
195
-            'number' => '<input type="number" '. $mode .'="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
196
-            'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">',
197
-            'textarea' => '<textarea '.$mode.'="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
198
-            'password' => '<input type="password" '. $mode .'="' . $key . '" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
193
+            'text' => '<input type="text" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
194
+            'email' => '<input type="email" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
195
+            'number' => '<input type="number" '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
196
+            'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">',
197
+            'textarea' => '<textarea '.$mode.'="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
198
+            'password' => '<input type="password" '.$mode.'="'.$key.'" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
199 199
         ];
200 200
         $str .= $array[$type];
201 201
 
202 202
         return $str;
203 203
     }
204 204
 
205
-    public function makeTab($count, $newLine = true){
205
+    public function makeTab($count, $newLine = true) {
206 206
         $count = $count * 4;
207 207
         $tabs = str_repeat(' ', $count);
208 208
 
Please login to merge, or discard this patch.