Passed
Pull Request — master (#53)
by yasin
04:06
created
database/migrations/2022_04_19_999999_add_acl_fields_to_cruds_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::table('cruds', function (Blueprint $table) {
16
+        Schema::table('cruds', function(Blueprint $table) {
17 17
             $table->boolean('with_acl')->default(false);
18 18
             $table->boolean('with_policy')->default(false);
19 19
         });
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function down()
28 28
     {
29
-        Schema::table('cruds', function (Blueprint $table) {
29
+        Schema::table('cruds', function(Blueprint $table) {
30 30
             $table->dropColumn(['with_acl', 'with_policy']);
31 31
         });
32 32
     }
Please login to merge, or discard this patch.
src/Http/Livewire/Admins/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
         UserProviderFacade::deleteAdmin($this->admin->id);
28 28
 
29
-        $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Admin') ] )]);
29
+        $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Admin')])]);
30 30
         $this->emit('adminsUpdated');
31 31
     }
32 32
 
Please login to merge, or discard this patch.
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/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 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 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
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 use EasyPanel\Contracts\CRUDComponent;
4 4
 
5
-if(! function_exists('getRouteName')) {
6
-    function getRouteName(){
5
+if (!function_exists('getRouteName')) {
6
+    function getRouteName() {
7 7
         $routeName = config('easy_panel.route_prefix');
8 8
         $routeName = trim($routeName, '/');
9 9
         $routeName = str_replace('/', '.', $routeName);
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
     }
12 12
 }
13 13
 
14
-if(! function_exists('getCrudConfig')) {
15
-    function getCrudConfig($name){
14
+if (!function_exists('getCrudConfig')) {
15
+    function getCrudConfig($name) {
16 16
         $namespace = "\\App\\CRUD\\{$name}Component";
17 17
 
18
-        if (!file_exists(app_path("/CRUD/{$name}Component.php")) or !class_exists($namespace)){
18
+        if (!file_exists(app_path("/CRUD/{$name}Component.php")) or !class_exists($namespace)) {
19 19
             abort(403, "Class with {$namespace} namespace doesn't exist");
20 20
         }
21 21
 
22 22
         $instance = app()->make($namespace);
23 23
 
24
-        if (!$instance instanceof CRUDComponent){
24
+        if (!$instance instanceof CRUDComponent) {
25 25
             abort(403, "{$namespace} should implement CRUDComponent interface");
26 26
         }
27 27
 
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
     }
30 30
 }
31 31
 
32
-if(! function_exists('crud')) {
33
-    function crud($name){
32
+if (!function_exists('crud')) {
33
+    function crud($name) {
34 34
         return \EasyPanel\Models\CRUD::query()->where('name', $name)->first();
35 35
     }
36 36
 }
37 37
 
38
-if (! function_exists('hasPermission')) {
38
+if (!function_exists('hasPermission')) {
39 39
     function hasPermission($routeName, $withAcl, $withPolicy = false, $entity = []) {
40 40
         $showButton = true;
41 41
 
Please login to merge, or discard this patch.
src/Parsers/StubParser.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
         $this->store = $store;
38 38
     }
39 39
 
40
-    public function setAuthType(bool $hasAuth){
40
+    public function setAuthType(bool $hasAuth) {
41 41
         $this->hasAuth = $hasAuth;
42 42
     }
43 43
 
44
-    public function setFields(array $fields){
44
+    public function setFields(array $fields) {
45 45
         $this->fields = $fields;
46 46
     }
47 47
 
48
-    public function setInputs(array $inputs){
48
+    public function setInputs(array $inputs) {
49 49
         $this->inputs = $inputs;
50 50
     }
51 51
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $fields = array_keys($this->inputs);
98 98
         $str = '';
99 99
 
100
-        if(in_array($this->inputName, $fields)){
100
+        if (in_array($this->inputName, $fields)) {
101 101
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
102 102
             die;
103 103
         }
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 
171 171
         foreach ($this->inputs as $key => $field) {
172 172
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
173
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
173
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
174 174
         }
175 175
 
176
-        if($this->hasAuth){
176
+        if ($this->hasAuth) {
177 177
             $str .= "'user_id' => auth()->id(),";
178 178
         }
179 179
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     /**
184 184
      * Create Blade from stub
185 185
      */
186
-    public function parseBlade($stub){
186
+    public function parseBlade($stub) {
187 187
         $modelName = $this->getModelName($this->parsedModel);
188 188
 
189 189
         $crud = crud(strtolower($modelName));
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     /**
267 267
      * Tab Maker (Each tabs mean 4 space)
268 268
      */
269
-    public function makeTab($count, $newLine = true){
269
+    public function makeTab($count, $newLine = true) {
270 270
         $count = $count * 4;
271 271
         $tabs = str_repeat(' ', $count);
272 272
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
     public function normalizeField($field)
284 284
     {
285
-        if($field instanceof Field){
285
+        if ($field instanceof Field) {
286 286
             return $field;
287 287
         }
288 288
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
         return Field::title($title);
292 292
     }
293 293
 
294
-    public function normalizeInput($key, $input){
295
-        if ($input instanceof BaseInput){
294
+    public function normalizeInput($key, $input) {
295
+        if ($input instanceof BaseInput) {
296 296
             return $input;
297 297
         }
298 298
 
Please login to merge, or discard this patch.
src/routes.php 1 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.