@@ -68,5 +68,5 @@ |
||
| 68 | 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 | - Route::get('/update/{admin}', \EasyPanel\Http\Livewire\Admins\Update::class)->name('update'); |
|
| 71 | + Route::get('/update/{admin}', \EasyPanel\Http\Livewire\Admins\Update::class)->name('update'); |
|
| 72 | 72 | }); |
@@ -4,7 +4,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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'); |
@@ -19,8 +19,9 @@ |
||
| 19 | 19 | if ($crud->with_acl) { |
| 20 | 20 | $middleware[] = "dynamicAcl"; |
| 21 | 21 | |
| 22 | - if ($crud->with_policy) |
|
| 23 | - $middleware[] = "authorize"; |
|
| 22 | + if ($crud->with_policy) { |
|
| 23 | + $middleware[] = "authorize"; |
|
| 24 | + } |
|
| 24 | 25 | } |
| 25 | 26 | |
| 26 | 27 | Route::prefix($crud->route)->middleware($middleware)->name("{$crud->route}.")->group(function () use ($component, $crud, $crudConfig) { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | $user = $this->findUser($id); |
| 14 | 14 | |
| 15 | - if ($user->panelAdmin()->exists()){ |
|
| 15 | + if ($user->panelAdmin()->exists()) { |
|
| 16 | 16 | return [ |
| 17 | 17 | 'type' => 'error', |
| 18 | 18 | 'message' => 'User already is an admin!' |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | 'is_superuser' => $is_super, |
| 24 | 24 | ]); |
| 25 | 25 | |
| 26 | - if($is_super) |
|
| 26 | + if ($is_super) |
|
| 27 | 27 | $this->makeSuperAdminRole($user); |
| 28 | 28 | |
| 29 | 29 | return [ |
@@ -23,8 +23,9 @@ |
||
| 23 | 23 | 'is_superuser' => $is_super, |
| 24 | 24 | ]); |
| 25 | 25 | |
| 26 | - if($is_super) |
|
| 27 | - $this->makeSuperAdminRole($user); |
|
| 26 | + if($is_super) { |
|
| 27 | + $this->makeSuperAdminRole($user); |
|
| 28 | + } |
|
| 28 | 29 | |
| 29 | 30 | return [ |
| 30 | 31 | 'type' => 'success', |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | public function register() |
| 32 | 32 | { |
| 33 | 33 | // Here we merge config with 'easy_panel' key |
| 34 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
| 34 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
| 35 | 35 | |
| 36 | 36 | // Check the status of module |
| 37 | - if(!config('easy_panel.enable')) { |
|
| 37 | + if (!config('easy_panel.enable')) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function boot() |
| 46 | 46 | { |
| 47 | - if(!config('easy_panel.enable')) { |
|
| 47 | + if (!config('easy_panel.enable')) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->bindCommands(); |
| 58 | 58 | |
| 59 | 59 | // Load Views with 'admin::' prefix |
| 60 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
| 60 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
| 61 | 61 | |
| 62 | 62 | // Register Middleware |
| 63 | 63 | $this->registerMiddlewareAlias(); |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | private function defineRoutes() |
| 78 | 78 | { |
| 79 | - if(!$this->app->routesAreCached()) { |
|
| 79 | + if (!$this->app->routesAreCached()) { |
|
| 80 | 80 | $middlewares = array_merge(['web', 'isAdmin', 'LangChanger'], config('easy_panel.additional_middlewares')); |
| 81 | 81 | |
| 82 | 82 | Route::prefix(config('easy_panel.route_prefix')) |
| 83 | 83 | ->middleware($middlewares) |
| 84 | - ->name(getRouteName() . '.') |
|
| 85 | - ->group(__DIR__ . '/routes.php'); |
|
| 84 | + ->name(getRouteName().'.') |
|
| 85 | + ->group(__DIR__.'/routes.php'); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | private function mergePublishes() |
| 121 | 121 | { |
| 122 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
| 122 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
| 123 | 123 | |
| 124 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
| 124 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
| 125 | 125 | |
| 126 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
| 126 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
| 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'), |
|
| 131 | - __DIR__ . '/../database/migrations/2022_04_19_999999_add_acl_fields_to_cruds_table.php' => base_path('/database/migrations/' . now()->tomorrow()->format('Y_m_d') . '_999999_add_acl_fields_to_cruds_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 | + __DIR__.'/../database/migrations/2022_04_19_999999_add_acl_fields_to_cruds_table.php' => base_path('/database/migrations/'.now()->tomorrow()->format('Y_m_d').'_999999_add_acl_fields_to_cruds_table.php') |
|
| 132 | 132 | ], 'easy-panel-migration'); |
| 133 | 133 | |
| 134 | 134 | $this->publishes([__DIR__.'/../resources/lang' => app()->langPath()], 'easy-panel-lang'); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | $model = !$this->app->runningUnitTests() ? config('easy_panel.user_model') : User::class; |
| 163 | 163 | |
| 164 | - $model::resolveRelationUsing('panelAdmin', function ($userModel){ |
|
| 164 | + $model::resolveRelationUsing('panelAdmin', function($userModel) { |
|
| 165 | 165 | return $userModel->hasOne(PanelAdmin::class)->latest(); |
| 166 | 166 | }); |
| 167 | 167 | } |