@@ -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'); |
@@ -15,7 +15,7 @@ discard block |
||
| 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 |
||
| 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 | }); |
@@ -13,7 +13,7 @@ |
||
| 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'); |
@@ -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'); |