Passed
Push — master ( 123176...12c361 )
by Reza
04:14
created
src/Http/Middleware/isAdmin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
 
11 11
     public function handle($request, Closure $next)
12 12
     {
13
-        if(auth()->guest()){
13
+        if (auth()->guest()) {
14 14
             return redirect(config('easy_panel.redirect_unauthorized'));
15 15
         }
16 16
 
17
-        if(!AuthFacade::checkIsAdmin(auth()->user()->id)){
17
+        if (!AuthFacade::checkIsAdmin(auth()->user()->id)) {
18 18
             return redirect(config('easy_panel.redirect_unauthorized'));
19 19
         }
20 20
 
Please login to merge, or discard this patch.
src/Support/User/UserProvider.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
         $user = $this->findUser($id);
13 13
         $modelInstance = app()->make(config('easy_panel.user_model'));
14 14
         $column = config('easy_panel.column');
15
-        if(in_array($column, $modelInstance->getFillable()) or !in_array($column, $modelInstance->getGuarded()))  {
15
+        if (in_array($column, $modelInstance->getFillable()) or !in_array($column, $modelInstance->getGuarded())) {
16 16
             $user->update([
17 17
                 config('easy_panel.column') => 1
18 18
             ]);
Please login to merge, or discard this patch.
src/routes.php 1 patch
Spacing   +6 added lines, -6 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');
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         $name = ucfirst($crud->name);
16 16
         $component = "App\\Http\\Livewire\\Admin\\$name";
17 17
 
18
-        Route::prefix($crud->route)->name("{$crud->route}.")->group(function () use ($component, $crud, $crudConfig) {
18
+        Route::prefix($crud->route)->name("{$crud->route}.")->group(function() use ($component, $crud, $crudConfig) {
19 19
 
20 20
             if (@class_exists("$component\\Read")) {
21 21
                 Route::get('/', "$component\\Read")->name('read');
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
26 26
             }
27 27
 
28 28
             if (@$crudConfig->update and @class_exists("$component\\Update")) {
29
-                Route::get('/update/{' . $crud->name . '}', "$component\\Update")->name('update');
29
+                Route::get('/update/{'.$crud->name.'}', "$component\\Update")->name('update');
30 30
             }
31 31
 
32 32
         });
33 33
     }
34 34
 }
35 35
 
36
-if(config('easy_panel.todo')){
37
-    Route::prefix('todo')->name('todo.')->group(function (){
36
+if (config('easy_panel.todo')) {
37
+    Route::prefix('todo')->name('todo.')->group(function() {
38 38
         Route::get('/', \EasyPanel\Http\Livewire\Todo\Lists::class)->name('lists');
39 39
         Route::get('/create', \EasyPanel\Http\Livewire\Todo\Create::class)->name('create');
40 40
     });
41 41
 }
42 42
 
43
-Route::prefix('crud')->name('crud.')->group(function (){
43
+Route::prefix('crud')->name('crud.')->group(function() {
44 44
     Route::get('/', \EasyPanel\Http\Livewire\CRUD\Lists::class)->name('lists');
45 45
 });
Please login to merge, or discard this patch.
src/EasyPanelServiceProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
     public function register()
37 37
     {
38 38
         // Here we merge config with 'easy_panel' key
39
-        $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel');
39
+        $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel');
40 40
 
41 41
         // Check the status of module
42
-        if(!config('easy_panel.enable')) {
42
+        if (!config('easy_panel.enable')) {
43 43
             return;
44 44
         }
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function boot()
51 51
     {
52
-        if(!config('easy_panel.enable')) {
52
+        if (!config('easy_panel.enable')) {
53 53
             return;
54 54
         }
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $this->bindCommands();
63 63
 
64 64
         // Load Views with 'admin::' prefix
65
-        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin');
65
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
66 66
 
67 67
         // Register Middleware
68 68
         $this->registerMiddlewareAlias();
@@ -76,11 +76,11 @@  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
             Route::prefix(config('easy_panel.route_prefix'))
81 81
                 ->middleware(['web', 'isAdmin', 'LangChanger'])
82
-                ->name(getRouteName() . '.')
83
-                ->group(__DIR__ . '/routes.php');
82
+                ->name(getRouteName().'.')
83
+                ->group(__DIR__.'/routes.php');
84 84
         }
85 85
     }
86 86
 
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 
111 111
     private function mergePublishes()
112 112
     {
113
-        $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
113
+        $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
114 114
 
115
-        $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
115
+        $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
116 116
 
117
-        $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');
117
+        $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');
118 118
 
119
-        $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-todo');
119
+        $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-todo');
120 120
 
121
-        $this->publishes([__DIR__ . '/../database/migrations/2021_07_17_99999_create_cruds_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_99999_create_cruds_table.php')], 'easy-panel-migration');
121
+        $this->publishes([__DIR__.'/../database/migrations/2021_07_17_99999_create_cruds_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_99999_create_cruds_table.php')], 'easy-panel-migration');
122 122
 
123 123
         $this->publishes([__DIR__.'/../resources/lang' => resource_path('/lang')], 'easy-panel-lang');
124 124
 
Please login to merge, or discard this patch.
src/Http/Livewire/CRUD/Single.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         ]);
25 25
 
26 26
         $this->crud->delete();
27
-        $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Todo') ] )]);
27
+        $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Todo')])]);
28 28
         $this->emit('crudUpdated');
29 29
     }
30 30
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             'built' => true
40 40
         ]);
41 41
 
42
-        $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully') ] );
42
+        $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully')]);
43 43
         $this->emit('crudUpdated');
44 44
     }
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             'active' => false
50 50
         ]);
51 51
 
52
-        $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated') ] );
52
+        $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated')]);
53 53
         $this->emit('crudUpdated');
54 54
     }
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             'active' => true
60 60
         ]);
61 61
 
62
-        $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated') ] );
62
+        $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated')]);
63 63
         $this->emit('crudUpdated');
64 64
     }
65 65
 
Please login to merge, or discard this patch.
src/Http/Livewire/CRUD/Create.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $this->validate();
29 29
 
30
-        if (!class_exists($this->model) or ! app()->make($this->model) instanceof Model){
30
+        if (!class_exists($this->model) or !app()->make($this->model) instanceof Model) {
31 31
             $this->addError('model', __('Namespace is invalid'));
32 32
 
33 33
             return;
34 34
         }
35 35
 
36
-        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)){
36
+        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)) {
37 37
             $this->addError('route', __('Route is invalid'));
38 38
 
39 39
             return;
40 40
         }
41 41
 
42
-        try{
42
+        try {
43 43
             $name = strtolower($this->getModelName($this->model));
44 44
             CRUD::create([
45 45
                 'model' => trim($this->model, '\\'),
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
                 '--force' => true
53 53
             ]);
54 54
 
55
-            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD') ])]);
56
-        } catch(\Exception $exception){
57
-            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError') ]);
55
+            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD')])]);
56
+        } catch (\Exception $exception) {
57
+            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError')]);
58 58
         }
59 59
 
60 60
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             ->layout('admin::layouts.app');
69 69
     }
70 70
 
71
-    private function getModelName($model){
71
+    private function getModelName($model) {
72 72
         $model = explode('\\', $model);
73 73
 
74 74
         return end($model);
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 = [
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
         $modelName = strtolower($this->getModelName($this->parsedModel));
217 217
         foreach ($fields as $value) {
218 218
             if (!is_array($value)) {
219
-                if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) {
220
-                    $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value);
219
+                if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) {
220
+                    $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value);
221 221
                 } else {
222
-                    $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);
222
+                    $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 223
                 }
224 224
             } else {
225 225
                 $relationName = array_key_first($value);
226
-                $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value);
226
+                $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value);
227 227
             }
228 228
         }
229 229
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 $str .= "<td style='cursor: pointer' wire:click=\"sort('$sortName')\"> <i class='fa @if(".'$sortType'." == 'desc' and ".'$sortColumn'." == '$sortName') fa-sort-amount-down ml-2 @elseif(".'$sortType == '."'asc' and ".'$sortColumn'." == '$sortName') fa-sort-amount-up ml-2 @endif'></i> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field);
245 245
             } else {
246 246
                 $relationName = array_key_first($field);
247
-                $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]);
247
+                $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]);
248 248
                 $str .= "<td> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field);
249 249
             }
250 250
             $this->texts[$field] = $field;
@@ -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
 
Please login to merge, or discard this patch.
src/Commands/CRUDActions/CommandBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
         ];
100 100
     }
101 101
 
102
-    private function setCRUDInstance(){
102
+    private function setCRUDInstance() {
103 103
         $modelName = $this->getNameInput();
104 104
 
105 105
         return $this->crudInstance = getCrudConfig($modelName);
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/{$name}Component.php"));
34 34
                 $this->info("{$name} files were deleted, make sure you will delete {$name} value from actions in config");
35 35
             } else {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function askResult($name)
43 43
     {
44
-        if($this->option('force')) {
44
+        if ($this->option('force')) {
45 45
             return true;
46 46
         }
47 47
         $result = $this->confirm("Do you really want to delete {$name} files ?", true);
Please login to merge, or discard this patch.