Passed
Push — master ( 5f9786...2bff8d )
by Reza
11:12
created
src/helpers.php 1 patch
Spacing   +13 added lines, -13 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,19 +11,19 @@  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
         
17
-        $crudName=ucfirst($name);
17
+        $crudName = ucfirst($name);
18 18
         $namespace = "\\App\\CRUD\\{$crudName}Component";
19 19
 
20
-        if (!class_exists($namespace)){
20
+        if (!class_exists($namespace)) {
21 21
             abort(403, "Class with {$namespace} namespace doesn't exist");
22 22
         }
23 23
 
24 24
         $instance = app()->make($namespace);
25 25
 
26
-        if (!$instance instanceof CRUDComponent){
26
+        if (!$instance instanceof CRUDComponent) {
27 27
             abort(403, "{$namespace} should implement CRUDComponent interface");
28 28
         }
29 29
 
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
     }
32 32
 }
33 33
 
34
-if(! function_exists('crud')) {
35
-    function crud($name){
34
+if (!function_exists('crud')) {
35
+    function crud($name) {
36 36
         return \EasyPanel\Models\CRUD::query()->where('name', $name)->first();
37 37
     }
38 38
 }
39 39
 
40
-if(! function_exists('get_icon')) {
41
-    function get_icon($type){
40
+if (!function_exists('get_icon')) {
41
+    function get_icon($type) {
42 42
         $array = [
43 43
             'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'],
44 44
             'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'],
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
             'truck' => ['product', 'products', 'shops', 'shop'],
56 56
             'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'],
57 57
         ];
58
-        foreach ($array as $key => $arrayValues){
59
-            if(in_array($type, $arrayValues)){
58
+        foreach ($array as $key => $arrayValues) {
59
+            if (in_array($type, $arrayValues)) {
60 60
                 $val = $key;
61 61
             }
62 62
         }
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,21 +26,21 @@  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
     Route::get('/create', \EasyPanel\Http\Livewire\CRUD\Create::class)->name('create');
46 46
 });
Please login to merge, or discard this patch.
database/migrations/2020_09_05_999999_create_todos_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('todos', function (Blueprint $table) {
16
+        Schema::create('todos', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->unsignedBigInteger('user_id');
19 19
             $table->string('title');
Please login to merge, or discard this patch.
database/migrations/2021_07_17_999999_create_cruds_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('cruds', function (Blueprint $table) {
16
+        Schema::create('cruds', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->string('name')->unique();
19 19
             $table->string('model')->unique();
Please login to merge, or discard this patch.
src/Http/Middleware/isAdmin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
     {
13 13
         auth()->shouldUse(config('easy_panel.auth_guard'));
14 14
 
15
-        if(auth()->guest()){
15
+        if (auth()->guest()) {
16 16
             return redirect(config('easy_panel.redirect_unauthorized'));
17 17
         }
18 18
 
19
-        if(!AuthFacade::check(auth()->user()->id)){
19
+        if (!AuthFacade::check(auth()->user()->id)) {
20 20
             return redirect(config('easy_panel.redirect_unauthorized'));
21 21
         }
22 22
 
Please login to merge, or discard this patch.
src/Commands/UserActions/GetAdmins.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         $admins = UserProviderFacade::getAdmins();
17 17
         $this->warn('Admin Lists :');
18
-        foreach ($admins as $admin){
18
+        foreach ($admins as $admin) {
19 19
             $message = $admin->panelAdmin->is_superuser
20 20
                 ? "• {$admin->name}: {$admin->email} ( Super Admin ✅ )"
21 21
                 : "• {$admin->name}: {$admin->email}";
Please login to merge, or discard this patch.
src/Commands/UserActions/MakeAdmin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
     public function handle()
16 16
     {
17 17
         $user = $this->argument('user');
18
-        try{
18
+        try {
19 19
             $status = UserProviderFacade::makeAdmin($user, $this->option('super'));
20 20
             $method = $status['type'] == 'success' ? 'info' : 'warn';
21 21
 
22 22
             $this->$method($status['message']);
23
-        } catch (\Exception $exception){
24
-            $this->warn("Something went wrong!\nError: ". $exception->getMessage());
23
+        } catch (\Exception $exception) {
24
+            $this->warn("Something went wrong!\nError: ".$exception->getMessage());
25 25
         }
26 26
     }
27 27
 
Please login to merge, or discard this patch.
src/EasyPanelServiceProvider.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     public function register()
39 39
     {
40 40
         // Here we merge config with 'easy_panel' key
41
-        $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel');
41
+        $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel');
42 42
 
43 43
         // Check the status of module
44
-        if(!config('easy_panel.enable')) {
44
+        if (!config('easy_panel.enable')) {
45 45
             return;
46 46
         }
47 47
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function boot()
53 53
     {
54
-        if(!config('easy_panel.enable')) {
54
+        if (!config('easy_panel.enable')) {
55 55
             return;
56 56
         }
57 57
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $this->bindCommands();
65 65
 
66 66
         // Load Views with 'admin::' prefix
67
-        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin');
67
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
68 68
 
69 69
         // Register Middleware
70 70
         $this->registerMiddlewareAlias();
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 
82 82
     private function defineRoutes()
83 83
     {
84
-        if(!$this->app->routesAreCached()) {
84
+        if (!$this->app->routesAreCached()) {
85 85
             $middlewares = array_merge(['web', 'isAdmin', 'LangChanger'], config('easy_panel.additional_middlewares'));
86 86
 
87 87
             Route::prefix(config('easy_panel.route_prefix'))
88 88
                 ->middleware($middlewares)
89
-                ->name(getRouteName() . '.')
90
-                ->group(__DIR__ . '/routes.php');
89
+                ->name(getRouteName().'.')
90
+                ->group(__DIR__.'/routes.php');
91 91
         }
92 92
     }
93 93
 
@@ -117,17 +117,17 @@  discard block
 block discarded – undo
117 117
 
118 118
     private function mergePublishes()
119 119
     {
120
-        $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
120
+        $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config');
121 121
 
122
-        $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
122
+        $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views');
123 123
 
124
-        $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');
124
+        $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');
125 125
 
126
-        $this->publishes([__DIR__ . '/../database/migrations/2020_09_05_999999_create_todos_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_admin_todos_table.php')], 'easy-panel-todo');
126
+        $this->publishes([__DIR__.'/../database/migrations/2020_09_05_999999_create_todos_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_999999_create_admin_todos_table.php')], 'easy-panel-todo');
127 127
 
128 128
         $this->publishes([
129
-            __DIR__ . '/../database/migrations/2021_07_17_999999_create_cruds_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_cruds_table.php'),
130
-            __DIR__ . '/../database/migrations/2021_12_17_999999_create_user_admins_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_user_admins_table.php')
129
+            __DIR__.'/../database/migrations/2021_07_17_999999_create_cruds_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_999999_create_cruds_table.php'),
130
+            __DIR__.'/../database/migrations/2021_12_17_999999_create_user_admins_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_999999_create_user_admins_table.php')
131 131
         ], 'easy-panel-migration');
132 132
 
133 133
         $this->publishes([__DIR__.'/../resources/lang' => resource_path('/lang')], '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/Support/User/UserProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     {
10 10
         $user = $this->findUser($id);
11 11
 
12
-        if ($user->panelAdmin()->exists()){
12
+        if ($user->panelAdmin()->exists()) {
13 13
             return [
14 14
                 'type' => 'error',
15 15
                 'message' => 'User already is an admin!'
Please login to merge, or discard this patch.