Passed
Push — master ( 618b98...bfb104 )
by Reza
02:45
created
src/EasyPanelServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  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');
28
-        if(config('easy_panel.enable')) {
27
+        $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel');
28
+        if (config('easy_panel.enable')) {
29 29
             $this->defineFacades();
30 30
             $this->bindCommands();
31 31
 
32 32
             foreach (config('easy_panel.actions') as $action) {
33
-                if(File::exists(resource_path("cruds/$action.php"))) {
33
+                if (File::exists(resource_path("cruds/$action.php"))) {
34 34
                     $data = include resource_path("cruds/$action.php");
35 35
                     config()->set("easy_panel.crud.$action", $data);
36 36
                 }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function boot()
42 42
     {
43
-        if(config('easy_panel.enable')) {
43
+        if (config('easy_panel.enable')) {
44 44
 
45 45
             if (!$this->app->runningInConsole()) {
46 46
                 $this->registerMiddlewareAlias();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 $this->loadLivewireComponent();
53 53
             }
54 54
 
55
-            $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin');
55
+            $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
56 56
 
57 57
             $this->mergePublishes();
58 58
         }
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     {
63 63
         Route::prefix(config('easy_panel.route_prefix'))
64 64
             ->middleware(['web', 'auth', 'isAdmin'])
65
-            ->name(getRouteName() .'.')
66
-            ->group(__DIR__ . '/routes.php');
65
+            ->name(getRouteName().'.')
66
+            ->group(__DIR__.'/routes.php');
67 67
     }
68 68
 
69 69
     private function defineFacades()
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 
88 88
     private function mergePublishes()
89 89
     {
90
-        $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
90
+        $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
91 91
 
92
-        $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
92
+        $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
93 93
 
94
-        $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__ . '/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles');
94
+        $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__.'/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles');
95 95
 
96
-        $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');
96
+        $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');
97 97
 
98 98
         $this->publishes([__DIR__.'/../resources/cruds' => resource_path('/cruds')], 'easy-panel-cruds');
99 99
     }
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');
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 function registerActionRoutes($action, $component, $crudConfig)
14 14
 {
15
-    Route::prefix($action)->name("$action.")->group(function () use ($component, $crudConfig, $action) {
15
+    Route::prefix($action)->name("$action.")->group(function() use ($component, $crudConfig, $action) {
16 16
 
17
-        if(class_exists("$component\\Read")) {
17
+        if (class_exists("$component\\Read")) {
18 18
             Route::get('/', "$component\\Read")->name('read');
19 19
         }
20 20
 
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
         }
24 24
 
25 25
         if ($crudConfig['update'] and class_exists("$component\\Update")) {
26
-            Route::get('/update/{' . $action . '}', "$component\\Update")->name('update');
26
+            Route::get('/update/{'.$action.'}', "$component\\Update")->name('update');
27 27
         }
28 28
 
29 29
     });
30 30
 }
31 31
 
32
-foreach (config('easy_panel.actions') as $action){
32
+foreach (config('easy_panel.actions') as $action) {
33 33
     $crudConfig = config('easy_panel.crud.'.$action);
34 34
     $name = ucfirst($action);
35 35
     $component = "App\\Http\\Livewire\\Admin\\$name";
36 36
     registerActionRoutes($action, $component, $crudConfig);
37 37
 }
38 38
 
39
-if(config('easy_panel.todo')){
40
-    Route::prefix('todo')->name('todo.')->group(function (){
39
+if (config('easy_panel.todo')) {
40
+    Route::prefix('todo')->name('todo.')->group(function() {
41 41
         Route::get('/', \EasyPanel\Http\Livewire\Todo\Lists::class)->name('lists');
42 42
         Route::get('/create', \EasyPanel\Http\Livewire\Todo\Create::class)->name('create');
43 43
     });
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/Actions/StubParser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         return str_replace(array_keys($array), array_values($array), $stub);
39 39
     }
40 40
 
41
-    protected function parseBlade($stub){
41
+    protected function parseBlade($stub) {
42 42
         $modelNamespace = $this->parseModel($this->getConfig('model'));
43 43
         $modelName = $this->getModelName($modelNamespace);
44 44
         $array = [
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
         return $this->qualifyModel($model);
62 62
     }
63 63
 
64
-    protected function getConfig($key){
64
+    protected function getConfig($key) {
65 65
         $action = $this->getNameInput();
66 66
 
67
-        if(config('easy_panel.crud.'.$action.'.'.$key)){
67
+        if (config('easy_panel.crud.'.$action.'.'.$key)) {
68 68
             return config('easy_panel.crud.'.$action.'.'.$key);
69 69
         }
70 70
 
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $str = '';
119 119
         foreach ($fields as $key => $field) {
120
-            $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,";
120
+            $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,";
121 121
         }
122 122
 
123 123
         $model = $this->getNameInput();
124
-        if(config("easy_panel.crud.$model.extra_values")){
124
+        if (config("easy_panel.crud.$model.extra_values")) {
125 125
             $str .= $this->parseExtraValues();
126 126
         }
127 127
 
128 128
         return $str;
129 129
     }
130 130
 
131
-    protected function parseExtraValues(){
131
+    protected function parseExtraValues() {
132 132
         $str = '';
133 133
 
134 134
         $values = $this->getConfig('extra_values');
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             $str .= '<div class="form-group">'.$this->makeTab(4);
173 173
             $str .= '<label for="input'.$key.'" class="col-sm-2 control-label">'.ucfirst($key).'</label>'.$this->makeTab(4);
174 174
             $str = $this->inputsHTML($type, $key, $str).$this->makeTab(4);
175
-            $str .='@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3);
175
+            $str .= '@error("'.$key.'") <div class="invalid-feedback">{{ $message }}</div> @enderror'.$this->makeTab(3);
176 176
             $str .= '</div>'.$this->makeTab(3);
177 177
         }
178 178
 
@@ -182,19 +182,19 @@  discard block
 block discarded – undo
182 182
     protected function inputsHTML($type, $key, string $str): string
183 183
     {
184 184
         $array = [
185
-            'text' => '<input type="text" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
186
-            'email' => '<input type="email" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
187
-            'number' => '<input type="number" wire:model.lazy="' . $key . '" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
188
-            'file' => '<input type="file" wire:model="' . $key . '" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input' . $key . '">',
189
-            'textarea' => '<textarea wire:model="' . $key . '" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
190
-            'password' => '<input type="password" wire:model.lazy="' . $key . '" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input' . $key . '">',
185
+            'text' => '<input type="text" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
186
+            'email' => '<input type="email" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
187
+            'number' => '<input type="number" wire:model.lazy="'.$key.'" class="form-control @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
188
+            'file' => '<input type="file" wire:model="'.$key.'" class="form-control-file @error(\''.$key.'\')is-invalid @enderror" id="input'.$key.'">',
189
+            'textarea' => '<textarea wire:model="'.$key.'" class="form-control @error(\''.$key.'\')is-invalid @enderror"></textarea>',
190
+            'password' => '<input type="password" wire:model.lazy="'.$key.'" class="form-control  @error(\''.$key.'\') is-invalid @enderror" id="input'.$key.'">',
191 191
         ];
192 192
         $str .= $array[$type];
193 193
 
194 194
         return $str;
195 195
     }
196 196
 
197
-    private function makeTab($count, $newLine = true){
197
+    private function makeTab($count, $newLine = true) {
198 198
         $count = $count * 4;
199 199
         $tabs = str_repeat(' ', $count);
200 200
 
Please login to merge, or discard this patch.