Passed
Branch master (410756)
by Reza
08:28
created
Category
src/Commands/MakeCRUD.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
     public function handle()
16 16
     {
17 17
         $names = $this->argument('name') ? [$this->argument('name')] : array_keys(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.actions.' . $name);
22
+            $config = config('easy_panel.actions.'.$name);
23 23
             if (!$config) {
24 24
                 throw new CommandNotFoundException("There is no {$name} in config file");
25 25
             }
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') ?: array_keys(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/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/StubParser.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -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,9 +64,9 @@  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
-        if(config('easy_panel.actions.'.$action.'.'.$key)){
69
+        if (config('easy_panel.actions.'.$action.'.'.$key)) {
70 70
             return config('easy_panel.actions.'.$action.'.'.$key);
71 71
         }
72 72
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $str = '';
121 121
         foreach ($fields as $key => $field) {
122
-            $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,\n            " : "'$key' => " . '$this' . "->$key,";
122
+            $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,\n            " : "'$key' => ".'$this'."->$key,";
123 123
         }
124 124
 
125 125
         return $str;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         foreach ($fields as $key => $type) {
158 158
             $str .= '<div class="form-group"><label for="input'.$key.'" class="col-sm-2 control-label">'.ucfirst($key).'</label>'.PHP_EOL;
159 159
             $str = $this->inputsHTML($type, $key, $str).PHP_EOL;
160
-            $str .='@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror</div>'.PHP_EOL;
160
+            $str .= '@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror</div>'.PHP_EOL;
161 161
         }
162 162
 
163 163
         return $str;
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
     protected function inputsHTML($type, $key, string $str): string
167 167
     {
168 168
         $array = [
169
-            'text' => '<input type="text" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL,
170
-            'email' => '<input type="email" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL,
171
-            'number' => '<input type="number" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL,
172
-            'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '"">'.PHP_EOL,
173
-            'textarea' => '<textarea wire:model="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>'.PHP_EOL,
174
-            'password' => '<input type="password" wire:model.lazy="' . $key . '" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">'.PHP_EOL,
169
+            'text' => '<input type="text" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL,
170
+            'email' => '<input type="email" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL,
171
+            'number' => '<input type="number" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL,
172
+            'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'"">'.PHP_EOL,
173
+            'textarea' => '<textarea wire:model="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>'.PHP_EOL,
174
+            'password' => '<input type="password" wire:model.lazy="'.$key.'" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">'.PHP_EOL,
175 175
         ];
176 176
         $str .= $array[$type];
177 177
 
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.
src/routes.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@
 block discarded – undo
4 4
 
5 5
 Route::view('/', "admin::home")->name('home');
6 6
 
7
-Route::post('/logout', function (){
7
+Route::post('/logout', function() {
8 8
     auth()->logout();
9 9
     return redirect(config('easy_panel.redirect_unauthorized'));
10 10
 })->name('logout');
11 11
 
12
-foreach (config('easy_panel.actions') as $prefix => $value){
12
+foreach (config('easy_panel.actions') as $prefix => $value) {
13 13
     $name = ucfirst($prefix);
14 14
     $livewireNamespace = "App\\Http\\Livewire\\Admin\\$name";
15
-    Route::prefix($prefix)->name($prefix.'.')->group(function () use ($livewireNamespace, $value, $prefix){
16
-        Route::get('/',  $livewireNamespace."\\Read")->name('read');
17
-        if($value['create']){
15
+    Route::prefix($prefix)->name($prefix.'.')->group(function() use ($livewireNamespace, $value, $prefix){
16
+        Route::get('/', $livewireNamespace."\\Read")->name('read');
17
+        if ($value['create']) {
18 18
             Route::get('/create', $livewireNamespace."\\Create")->name('create');
19 19
         }
20
-        if($value['update']){
21
-            Route::get('/update/{'.$prefix.'}',  $livewireNamespace."\\Update")->name('update');
20
+        if ($value['update']) {
21
+            Route::get('/update/{'.$prefix.'}', $livewireNamespace."\\Update")->name('update');
22 22
         }
23 23
     });
24 24
 }
25 25
 
26
-if(config('easy_panel.todo')){
27
-    Route::prefix('todo')->name('todo.')->group(function (){
26
+if (config('easy_panel.todo')) {
27
+    Route::prefix('todo')->name('todo.')->group(function() {
28 28
         Route::get('/', \EasyPanel\Http\Livewire\Todo\Lists::class)->name('lists');
29 29
         Route::get('/create', \EasyPanel\Http\Livewire\Todo\Create::class)->name('create');
30 30
     });
Please login to merge, or discard this patch.
src/EasyPanelServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 {
25 25
     public function register()
26 26
     {
27
-        $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel');
27
+        $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel');
28 28
         $this->defineFacades();
29 29
         $this->bindCommands();
30 30
     }
31 31
 
32 32
     public function boot()
33 33
     {
34
-        if(!$this->app->runningInConsole()) {
34
+        if (!$this->app->runningInConsole()) {
35 35
             $this->registerMiddlewareAlias();
36 36
 
37 37
             if (!$this->app->routesAreCached()) {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             $this->loadLivewireComponent();
42 42
         }
43 43
 
44
-        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin');
44
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
45 45
 
46 46
         $this->mergePublishes();
47 47
     }
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
     {
51 51
         Route::prefix(config('easy_panel.route_prefix'))
52 52
             ->middleware(['web', 'auth', 'isAdmin'])
53
-            ->name(getRouteName() .'.')
54
-            ->group(__DIR__ . '/routes.php');
53
+            ->name(getRouteName().'.')
54
+            ->group(__DIR__.'/routes.php');
55 55
     }
56 56
 
57 57
     private function defineFacades()
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 
76 76
     private function mergePublishes()
77 77
     {
78
-        $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
78
+        $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
79 79
 
80
-        $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
80
+        $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
81 81
 
82
-        $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__ . '/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles');
82
+        $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__.'/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles');
83 83
 
84
-        $this->publishes([__DIR__ . '/../database/migrations/2020_09_05_99999_create_todos_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_99999_create_admin_todos_table.php')], 'easy-panel-migrations');
84
+        $this->publishes([__DIR__.'/../database/migrations/2020_09_05_99999_create_todos_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_99999_create_admin_todos_table.php')], 'easy-panel-migrations');
85 85
     }
86 86
 
87 87
     private function bindCommands()
Please login to merge, or discard this patch.