Passed
Pull Request — master (#76)
by
unknown
20:16
created
src/Http/Livewire/Admins/Create.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     private function fixAccessKeys()
21 21
     {
22
-        foreach($this->access as $key => $value) {
22
+        foreach ($this->access as $key => $value) {
23 23
             unset($this->access[$key]);
24 24
             $key = str_replace('-', '.', $key);
25 25
             $this->access[$key] = $value;
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
         try {
36 36
             Role::create(['name' => $this->name, 'permissions' => $this->fixAccessKeys()]);
37 37
 
38
-            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Role') ])]);
39
-        } catch (\Exception $exception){
38
+            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Role')])]);
39
+        } catch (\Exception $exception) {
40 40
             $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => $exception->getMessage()]);
41 41
         }
42 42
 
@@ -48,6 +48,6 @@  discard block
 block discarded – undo
48 48
         $permissions = ACL::getRoutes();
49 49
 
50 50
         return view('admin::livewire.role.create', compact('permissions'))
51
-            ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('Role') ])]);
51
+            ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('Role')])]);
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
src/Http/Livewire/Admins/Update.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,13 @@
 block discarded – undo
36 36
 
37 37
     public function update()
38 38
     {
39
-        if ($this->getRules())
40
-            $this->validate();
39
+        if ($this->getRules()) {
40
+                    $this->validate();
41
+        }
41 42
 
42
-        if ($this->selectedRoles[0] == "null")
43
-            $this->selectedRoles = [];
43
+        if ($this->selectedRoles[0] == "null") {
44
+                    $this->selectedRoles = [];
45
+        }
44 46
 
45 47
         $this->admin->roles()->sync($this->selectedRoles);
46 48
 
Please login to merge, or discard this patch.
src/Http/Livewire/Role/Single.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         
27 27
         $this->role->delete();
28 28
 
29
-        $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Role') ] )]);
29
+        $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Role')])]);
30 30
         $this->emit('roleUpdated');
31 31
     }
32 32
 
Please login to merge, or discard this patch.
src/Http/Livewire/Role/Create.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     private function fixAccessKeys()
25 25
     {
26
-        foreach($this->access as $key => $value) {
26
+        foreach ($this->access as $key => $value) {
27 27
             unset($this->access[$key]);
28 28
             $key = str_replace('-', '.', $key);
29 29
             $this->access[$key] = is_array($value) ? array_filter($value) : $value;
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         try {
55 55
             Role::create(['name' => $this->name, 'permissions' => $this->fixAccessKeys()]);
56 56
 
57
-            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Role') ])]);
58
-        } catch (\Exception $exception){
57
+            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Role')])]);
58
+        } catch (\Exception $exception) {
59 59
             $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => $exception->getMessage()]);
60 60
         }
61 61
 
@@ -67,6 +67,6 @@  discard block
 block discarded – undo
67 67
         $this->permissionsData = ACL::getRoutes();
68 68
 
69 69
         return view('admin::livewire.role.create', ['permissions' => $this->permissionsData])
70
-            ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('Role') ])]);
70
+            ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('Role')])]);
71 71
     }
72 72
 }
Please login to merge, or discard this patch.
src/Http/Livewire/Role/Update.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function update()
57 57
     {
58
-        if ($this->getRules())
59
-            $this->validate();
58
+        if ($this->getRules()) {
59
+                    $this->validate();
60
+        }
60 61
 
61 62
         if ($this->role->is_super_admin()) {
62 63
             $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('CannotUpdateMessage', ['name' => __('Role')])]);
@@ -84,8 +85,9 @@  discard block
 block discarded – undo
84 85
             $dashKey = str_replace('.', '-', $key);
85 86
             $value = is_array($value) ? array_filter($value) : $value; 
86 87
 
87
-            if (empty($value))
88
-                continue;
88
+            if (empty($value)) {
89
+                            continue;
90
+            }
89 91
 
90 92
             $this->access[$dashKey] = $value;
91 93
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     private function setSelectedAccess($rolePermissions)
82 82
     {
83
-        foreach($rolePermissions as $key => $value) { 
83
+        foreach ($rolePermissions as $key => $value) { 
84 84
             $dashKey = str_replace('.', '-', $key);
85 85
             $value = is_array($value) ? array_filter($value) : $value; 
86 86
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $access = $this->access;
99 99
         
100
-        foreach($access as $key => $value) {
100
+        foreach ($access as $key => $value) {
101 101
             unset($access[$key]);
102 102
             $key = str_replace('-', '.', $key);
103 103
             $access[$key] = is_array($value) ? array_filter($value) : $value;
Please login to merge, or discard this patch.
src/routes.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,5 +68,5 @@
 block discarded – undo
68 68
 Route::prefix('admins')->middleware('dynamicAcl')->name('admins.')->group(function (){
69 69
     Route::get('/', \EasyPanel\Http\Livewire\Admins\Lists::class)->name('lists');
70 70
     // Route::get('/create', \EasyPanel\Http\Livewire\Admins\Create::class)->name('create');
71
-     Route::get('/update/{admin}', \EasyPanel\Http\Livewire\Admins\Update::class)->name('update');
71
+        Route::get('/update/{admin}', \EasyPanel\Http\Livewire\Admins\Update::class)->name('update');
72 72
 });
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 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');
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
                 $middleware[] = "authorize";
24 24
         }
25 25
 
26
-        Route::prefix($crud->route)->middleware($middleware)->name("{$crud->route}.")->group(function () use ($component, $crud, $crudConfig) {
26
+        Route::prefix($crud->route)->middleware($middleware)->name("{$crud->route}.")->group(function() use ($component, $crud, $crudConfig) {
27 27
 
28 28
             if (@class_exists("$component\\Read")) {
29 29
                 Route::get('/', "$component\\Read")->name('read');
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
             }
35 35
 
36 36
             if (@$crudConfig->update and @class_exists("$component\\Update")) {
37
-                Route::get('/update/{' . $crud->name . '}', "$component\\Update")->name('update');
37
+                Route::get('/update/{'.$crud->name.'}', "$component\\Update")->name('update');
38 38
             }
39 39
 
40 40
         });
41 41
     }
42 42
 }
43 43
 
44
-Route::prefix('crud')->middleware('dynamicAcl')->name('crud.')->group(function (){
44
+Route::prefix('crud')->middleware('dynamicAcl')->name('crud.')->group(function() {
45 45
     Route::get('/', \EasyPanel\Http\Livewire\CRUD\Lists::class)->name('lists');
46 46
     Route::get('/create', \EasyPanel\Http\Livewire\CRUD\Create::class)->name('create');
47 47
 });
48 48
 
49
-Route::get('setLang', function (){
49
+Route::get('setLang', function() {
50 50
     $lang = request()->get('lang');
51 51
 
52 52
     session()->put('easypanel_lang', $lang);
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
     ->middleware('dynamicAcl')
60 60
     ->name('translation');
61 61
 
62
-Route::prefix('role')->middleware('dynamicAcl')->name('role.')->group(function (){
62
+Route::prefix('role')->middleware('dynamicAcl')->name('role.')->group(function() {
63 63
     Route::get('/', \EasyPanel\Http\Livewire\Role\Lists::class)->name('lists');
64 64
     Route::get('/create', \EasyPanel\Http\Livewire\Role\Create::class)->name('create');
65 65
     Route::get('/update/{role}', \EasyPanel\Http\Livewire\Role\Update::class)->name('update');
66 66
 });
67 67
 
68
-Route::prefix('admins')->middleware('dynamicAcl')->name('admins.')->group(function (){
68
+Route::prefix('admins')->middleware('dynamicAcl')->name('admins.')->group(function() {
69 69
     Route::get('/', \EasyPanel\Http\Livewire\Admins\Lists::class)->name('lists');
70 70
     // Route::get('/create', \EasyPanel\Http\Livewire\Admins\Create::class)->name('create');
71 71
      Route::get('/update/{admin}', \EasyPanel\Http\Livewire\Admins\Update::class)->name('update');
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@
 block discarded – undo
19 19
         if ($crud->with_acl) {
20 20
             $middleware[] = "dynamicAcl";
21 21
 
22
-            if ($crud->with_policy)
23
-                $middleware[] = "authorize";
22
+            if ($crud->with_policy) {
23
+                            $middleware[] = "authorize";
24
+            }
24 25
         }
25 26
 
26 27
         Route::prefix($crud->route)->middleware($middleware)->name("{$crud->route}.")->group(function () use ($component, $crud, $crudConfig) {
Please login to merge, or discard this patch.
src/Support/User/UserProvider.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     {
13 13
         $user = $this->findUser($id);
14 14
 
15
-        if ($user->panelAdmin()->exists()){
15
+        if ($user->panelAdmin()->exists()) {
16 16
             return [
17 17
                 'type' => 'error',
18 18
                 'message' => 'User already is an admin!'
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             'is_superuser' => $is_super,
24 24
         ]);
25 25
 
26
-        if($is_super)
26
+        if ($is_super)
27 27
             $this->makeSuperAdminRole($user);
28 28
 
29 29
         return [
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@
 block discarded – undo
23 23
             'is_superuser' => $is_super,
24 24
         ]);
25 25
 
26
-        if($is_super)
27
-            $this->makeSuperAdminRole($user);
26
+        if($is_super) {
27
+                    $this->makeSuperAdminRole($user);
28
+        }
28 29
 
29 30
         return [
30 31
             'type' => 'success',
Please login to merge, or discard this patch.
src/EasyPanelServiceProvider.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
     public function register()
32 32
     {
33 33
         // Here we merge config with 'easy_panel' key
34
-        $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel');
34
+        $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel');
35 35
 
36 36
         // Check the status of module
37
-        if(!config('easy_panel.enable')) {
37
+        if (!config('easy_panel.enable')) {
38 38
             return;
39 39
         }
40 40
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function boot()
46 46
     {
47
-        if(!config('easy_panel.enable')) {
47
+        if (!config('easy_panel.enable')) {
48 48
             return;
49 49
         }
50 50
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $this->bindCommands();
58 58
 
59 59
         // Load Views with 'admin::' prefix
60
-        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin');
60
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
61 61
 
62 62
         // Register Middleware
63 63
         $this->registerMiddlewareAlias();
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 
77 77
     private function defineRoutes()
78 78
     {
79
-        if(!$this->app->routesAreCached()) {
79
+        if (!$this->app->routesAreCached()) {
80 80
             $middlewares = array_merge(['web', 'isAdmin', 'LangChanger'], config('easy_panel.additional_middlewares'));
81 81
 
82 82
             Route::prefix(config('easy_panel.route_prefix'))
83 83
                 ->middleware($middlewares)
84
-                ->name(getRouteName() . '.')
85
-                ->group(__DIR__ . '/routes.php');
84
+                ->name(getRouteName().'.')
85
+                ->group(__DIR__.'/routes.php');
86 86
         }
87 87
     }
88 88
 
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 
120 120
     private function mergePublishes()
121 121
     {
122
-        $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
122
+        $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
123 123
 
124
-        $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
124
+        $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
125 125
 
126
-        $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');
126
+        $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');
127 127
 
128 128
         $this->publishes([
129
-            __DIR__ . '/../database/migrations/cruds_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_cruds_table_easypanel.php'),
130
-            __DIR__ . '/../database/migrations/panel_admins_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_panel_admins_table_easypanel.php'),
129
+            __DIR__.'/../database/migrations/cruds_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_999999_create_cruds_table_easypanel.php'),
130
+            __DIR__.'/../database/migrations/panel_admins_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_999999_create_panel_admins_table_easypanel.php'),
131 131
         ], 'easy-panel-migration');
132 132
 
133 133
         $this->publishes([__DIR__.'/../resources/lang' => app()->langPath()], 'easy-panel-lang');
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     {
161 161
         $model = !$this->app->runningUnitTests() ? config('easy_panel.user_model') : User::class;
162 162
 
163
-        $model::resolveRelationUsing('panelAdmin', function ($userModel){
163
+        $model::resolveRelationUsing('panelAdmin', function($userModel) {
164 164
             return $userModel->hasOne(PanelAdmin::class)->latest();
165 165
         });
166 166
     }
Please login to merge, or discard this patch.
src/Parsers/StubParser.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
         $this->store = $store;
39 39
     }
40 40
 
41
-    public function setAuthType(bool $hasAuth){
41
+    public function setAuthType(bool $hasAuth) {
42 42
         $this->hasAuth = $hasAuth;
43 43
     }
44 44
 
45
-    public function setFields(array $fields){
45
+    public function setFields(array $fields) {
46 46
         $this->fields = $fields;
47 47
     }
48 48
 
49
-    public function setInputs(array $inputs){
49
+    public function setInputs(array $inputs) {
50 50
         $this->inputs = $inputs;
51 51
     }
52 52
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $fields = array_keys($this->inputs);
99 99
         $str = '';
100 100
 
101
-        if(in_array($this->inputName, $fields)){
101
+        if (in_array($this->inputName, $fields)) {
102 102
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
103 103
             die;
104 104
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $str = '';
119 119
         foreach ($this->inputs as $key => $input) {
120 120
             $inputObject = $this->normalizeInput($key, $input);
121
-            if (! $inputObject instanceof File){
121
+            if (!$inputObject instanceof File) {
122 122
                 continue;
123 123
             }
124 124
             // We get store path which has been defined in crud's config file
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 
175 175
         foreach ($this->inputs as $key => $field) {
176 176
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
177
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
177
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
178 178
         }
179 179
 
180
-        if($this->hasAuth){
180
+        if ($this->hasAuth) {
181 181
             $str .= "'user_id' => auth()->id(),";
182 182
         }
183 183
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * Create Blade from stub
189 189
      */
190
-    public function parseBlade($stub){
190
+    public function parseBlade($stub) {
191 191
         $modelName = $this->getModelName($this->parsedModel);
192 192
 
193 193
         $crud = crud(strtolower($modelName));
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     /**
271 271
      * Tab Maker (Each tabs mean 4 space)
272 272
      */
273
-    public function makeTab($count, $newLine = true){
273
+    public function makeTab($count, $newLine = true) {
274 274
         $count = $count * 4;
275 275
         $tabs = str_repeat(' ', $count);
276 276
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
     public function normalizeField($field)
288 288
     {
289
-        if($field instanceof Field){
289
+        if ($field instanceof Field) {
290 290
             return $field;
291 291
         }
292 292
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
         return Field::title($title);
296 296
     }
297 297
 
298
-    public function normalizeInput($key, $input){
299
-        if ($input instanceof BaseInput){
298
+    public function normalizeInput($key, $input) {
299
+        if ($input instanceof BaseInput) {
300 300
             return $input;
301 301
         }
302 302
 
Please login to merge, or discard this patch.