@@ -13,7 +13,7 @@ |
||
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(); |
@@ -12,11 +12,11 @@ |
||
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 |
@@ -15,7 +15,7 @@ |
||
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}"; |
@@ -15,13 +15,13 @@ |
||
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 |
@@ -38,10 +38,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -9,7 +9,7 @@ |
||
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!' |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('panel_admins', function (Blueprint $table) { |
|
16 | + Schema::create('panel_admins', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->foreignId('user_id')->constrained(); |
19 | 19 | $table->boolean('is_superuser'); |
@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | { |
62 | 62 | $this->validate(); |
63 | 63 | |
64 | - if (!class_exists($this->model) or ! app()->make($this->model) instanceof Model){ |
|
64 | + if (!class_exists($this->model) or !app()->make($this->model) instanceof Model) { |
|
65 | 65 | $this->addError('model', __('Namespace is invalid')); |
66 | 66 | |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - if (!preg_match('/^([a-z]|[0-9])+/', $this->route)){ |
|
70 | + if (!preg_match('/^([a-z]|[0-9])+/', $this->route)) { |
|
71 | 71 | $this->addError('route', __('Route is invalid')); |
72 | 72 | |
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | - try{ |
|
76 | + try { |
|
77 | 77 | $name = $this->getModelName($this->model); |
78 | 78 | |
79 | 79 | CRUD::create([ |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | '--force' => true |
89 | 89 | ]); |
90 | 90 | |
91 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD') ])]); |
|
92 | - } catch(\Exception $exception){ |
|
93 | - $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError') ]); |
|
91 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD')])]); |
|
92 | + } catch (\Exception $exception) { |
|
93 | + $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError')]); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ->layout('admin::layouts.app'); |
105 | 105 | } |
106 | 106 | |
107 | - private function getModelName($model){ |
|
107 | + private function getModelName($model) { |
|
108 | 108 | $model = explode('\\', $model); |
109 | 109 | |
110 | 110 | return end($model); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | foreach ($files as $file) { |
122 | 122 | |
123 | - if ($this->fileCanNotBeListed($file->getFilename(), $query)){ |
|
123 | + if ($this->fileCanNotBeListed($file->getFilename(), $query)) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 |
@@ -99,7 +99,7 @@ discard block |
||
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); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | protected function qualifyModel($model) |
124 | 124 | { |
125 | - if (class_exists($model)){ |
|
125 | + if (class_exists($model)) { |
|
126 | 126 | return $model; |
127 | 127 | } |
128 | 128 |