@@ -25,17 +25,17 @@ |
||
| 25 | 25 | |
| 26 | 26 | protected function getStub() |
| 27 | 27 | { |
| 28 | - return __DIR__ . "/../stub/{$this->file}.stub"; |
|
| 28 | + return __DIR__."/../stub/{$this->file}.stub"; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | private function buildBlade() |
| 32 | 32 | { |
| 33 | - $stub = $this->files->get(__DIR__ . "/../stub/blade/{$this->file}.blade.stub"); |
|
| 33 | + $stub = $this->files->get(__DIR__."/../stub/blade/{$this->file}.blade.stub"); |
|
| 34 | 34 | $newStub = $this->parseBlade($stub); |
| 35 | 35 | |
| 36 | 36 | $path = $this->viewPath("livewire/admin/{$this->getNameInput()}/{$this->file}.blade.php"); |
| 37 | 37 | |
| 38 | - if (! $this->files->isDirectory(dirname($path))) { |
|
| 38 | + if (!$this->files->isDirectory(dirname($path))) { |
|
| 39 | 39 | $this->files->makeDirectory(dirname($path), 0755, true); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | public function handle() |
| 18 | 18 | { |
| 19 | 19 | $user = $this->argument('user'); |
| 20 | - try{ |
|
| 20 | + try { |
|
| 21 | 21 | UserProviderFacade::makeAdmin($user); |
| 22 | 22 | $this->info("User {$user} was converted to an admin"); |
| 23 | - } catch (\Exception $exception){ |
|
| 23 | + } catch (\Exception $exception) { |
|
| 24 | 24 | $this->error("User {$user} does not exist"); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function handle($request, Closure $next) |
| 14 | 14 | { |
| 15 | - if(AuthFacade::checkIsAdmin(auth()->user()->id)){ |
|
| 15 | + if (AuthFacade::checkIsAdmin(auth()->user()->id)) { |
|
| 16 | 16 | return $next($request); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -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'); |
@@ -15,11 +15,11 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | public function register() |
| 27 | 27 | { |
| 28 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
| 29 | - if(!config('easy_panel.enable')) { |
|
| 28 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
| 29 | + if (!config('easy_panel.enable')) { |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $this->bindCommands(); |
| 35 | 35 | |
| 36 | 36 | foreach (config('easy_panel.actions') as $action) { |
| 37 | - if(!File::exists(resource_path("cruds/$action.php"))) { |
|
| 37 | + if (!File::exists(resource_path("cruds/$action.php"))) { |
|
| 38 | 38 | continue; |
| 39 | 39 | } |
| 40 | 40 | $data = require resource_path("cruds/$action.php"); |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Load Views |
| 56 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
| 56 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
| 57 | 57 | |
| 58 | 58 | // Register Middleware |
| 59 | 59 | $this->registerMiddlewareAlias(); |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | private function defineRoutes() |
| 69 | 69 | { |
| 70 | - if(!$this->app->routesAreCached()) { |
|
| 70 | + if (!$this->app->routesAreCached()) { |
|
| 71 | 71 | Route::prefix(config('easy_panel.route_prefix')) |
| 72 | 72 | ->middleware(['web', 'auth', 'isAdmin']) |
| 73 | - ->name(getRouteName() . '.') |
|
| 74 | - ->group(__DIR__ . '/routes.php'); |
|
| 73 | + ->name(getRouteName().'.') |
|
| 74 | + ->group(__DIR__.'/routes.php'); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | private function mergePublishes() |
| 98 | 98 | { |
| 99 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
| 99 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
| 100 | 100 | |
| 101 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
| 101 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
| 102 | 102 | |
| 103 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
| 103 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
| 104 | 104 | |
| 105 | - $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'); |
|
| 105 | + $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'); |
|
| 106 | 106 | |
| 107 | 107 | $this->publishes([__DIR__.'/../resources/cruds' => resource_path('/cruds')], 'easy-panel-cruds'); |
| 108 | 108 | } |
@@ -4,20 +4,20 @@ |
||
| 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'); |
| 11 | 11 | |
| 12 | -foreach (config('easy_panel.actions') as $action){ |
|
| 12 | +foreach (config('easy_panel.actions') as $action) { |
|
| 13 | 13 | $crudConfig = config('easy_panel.crud.'.$action); |
| 14 | 14 | $name = ucfirst($action); |
| 15 | 15 | $component = "App\\Http\\Livewire\\Admin\\$name"; |
| 16 | 16 | registerActionRoutes($action, $component, $crudConfig); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if(config('easy_panel.todo')){ |
|
| 20 | - Route::prefix('todo')->name('todo.')->group(function (){ |
|
| 19 | +if (config('easy_panel.todo')) { |
|
| 20 | + Route::prefix('todo')->name('todo.')->group(function() { |
|
| 21 | 21 | Route::get('/', \EasyPanel\Http\Livewire\Todo\Lists::class)->name('lists'); |
| 22 | 22 | Route::get('/create', \EasyPanel\Http\Livewire\Todo\Create::class)->name('create'); |
| 23 | 23 | }); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $admins = UserProviderFacade::getAdmins(); |
| 20 | 20 | $this->warn('Admin Lists :'); |
| 21 | - foreach ($admins as $admin){ |
|
| 21 | + foreach ($admins as $admin) { |
|
| 22 | 22 | $this->warn("• {$admin->name}: {$admin->email}"); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(! function_exists('getRouteName')) { |
|
| 4 | - function getRouteName(){ |
|
| 3 | +if (!function_exists('getRouteName')) { |
|
| 4 | + function getRouteName() { |
|
| 5 | 5 | $routeName = config('easy_panel.route_prefix'); |
| 6 | 6 | $routeName = trim($routeName, '/'); |
| 7 | 7 | $routeName = str_replace('/', '.', $routeName); |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -if(! function_exists('get_icon')) { |
|
| 13 | - function get_icon($type){ |
|
| 12 | +if (!function_exists('get_icon')) { |
|
| 13 | + function get_icon($type) { |
|
| 14 | 14 | $array = [ |
| 15 | 15 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
| 16 | 16 | 'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | 'music' => ['musics', 'music', 'audios', 'audio'], |
| 24 | 24 | 'bell' => ['notifications', 'notification'], |
| 25 | 25 | ]; |
| 26 | - foreach ($array as $key => $arrayValues){ |
|
| 27 | - if(in_array($type, $arrayValues)){ |
|
| 26 | + foreach ($array as $key => $arrayValues) { |
|
| 27 | + if (in_array($type, $arrayValues)) { |
|
| 28 | 28 | $val = $key; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -if(! function_exists('registerActionRoutes')){ |
|
| 35 | +if (!function_exists('registerActionRoutes')) { |
|
| 36 | 36 | function registerActionRoutes($action, $component, $crudConfig) |
| 37 | 37 | { |
| 38 | - Route::prefix($action)->name("$action.")->group(function () use ($component, $crudConfig, $action) { |
|
| 38 | + Route::prefix($action)->name("$action.")->group(function() use ($component, $crudConfig, $action) { |
|
| 39 | 39 | |
| 40 | - if(@class_exists("$component\\Read")) { |
|
| 40 | + if (@class_exists("$component\\Read")) { |
|
| 41 | 41 | Route::get('/', "$component\\Read")->name('read'); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if (@$crudConfig['update'] and @class_exists("$component\\Update")) { |
| 49 | - Route::get('/update/{' . $action . '}', "$component\\Update")->name('update'); |
|
| 49 | + Route::get('/update/{'.$action.'}', "$component\\Update")->name('update'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | }); |