@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function handle() |
17 | 17 | { |
18 | 18 | $names = (array) $this->argument('name') ?: array_keys(config('easy_panel.actions', [])); |
19 | - if($names == null) { |
|
19 | + if ($names == null) { |
|
20 | 20 | throw new CommandNotFoundException("There is no action in config file"); |
21 | 21 | } |
22 | 22 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | if ($this->askResult($name)) { |
30 | 30 | File::deleteDirectory(resource_path("/views/livewire/admin/$name")); |
31 | - File::deleteDirectory(app_path("/Http/Livewire/Admin/" . ucfirst($name))); |
|
31 | + File::deleteDirectory(app_path("/Http/Livewire/Admin/".ucfirst($name))); |
|
32 | 32 | $this->info("{$name} files were deleted, make sure you run panel:crud to create files again"); |
33 | 33 | } else { |
34 | 34 | $this->line("process for {$name} action was canceled."); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function askResult($name) |
41 | 41 | { |
42 | - if($this->option('force')) { |
|
42 | + if ($this->option('force')) { |
|
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | $result = $this->confirm("Do you really want to delete {$name} files ?", 'yes'); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | $user = $this->argument('user'); |
20 | 20 | |
21 | - if($this->askResult($user)){ |
|
21 | + if ($this->askResult($user)) { |
|
22 | 22 | UserProviderFacade::deleteAdmin($user); |
23 | 23 | $this->info('Admin was removed successfully'); |
24 | 24 | } else { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function askResult($user) |
30 | 30 | { |
31 | - if($this->option('force')) { |
|
31 | + if ($this->option('force')) { |
|
32 | 32 | return true; |
33 | 33 | } |
34 | 34 | $result = $this->confirm("Do you want to remove {$user} from administration", 'yes'); |
@@ -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 |
@@ -4,27 +4,27 @@ |
||
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 $prefix => $value){ |
|
12 | +foreach (config('easy_panel.actions') as $prefix => $value) { |
|
13 | 13 | $name = ucfirst($prefix); |
14 | 14 | $livewireNamespace = "App\\Http\\Livewire\\Admin\\$name"; |
15 | - Route::prefix($prefix)->name($prefix.'.')->group(function () use ($livewireNamespace, $value, $prefix){ |
|
16 | - Route::get('/', $livewireNamespace."\\Read")->name('read'); |
|
17 | - if($value['create']){ |
|
15 | + Route::prefix($prefix)->name($prefix.'.')->group(function() use ($livewireNamespace, $value, $prefix){ |
|
16 | + Route::get('/', $livewireNamespace."\\Read")->name('read'); |
|
17 | + if ($value['create']) { |
|
18 | 18 | Route::get('/create', $livewireNamespace."\\Create")->name('create'); |
19 | 19 | } |
20 | - if($value['update']){ |
|
21 | - Route::get('/update/{'.$prefix.'}', $livewireNamespace."\\Update")->name('update'); |
|
20 | + if ($value['update']) { |
|
21 | + Route::get('/update/{'.$prefix.'}', $livewireNamespace."\\Update")->name('update'); |
|
22 | 22 | } |
23 | 23 | }); |
24 | 24 | } |
25 | 25 | |
26 | -if(config('easy_panel.todo')){ |
|
27 | - Route::prefix('todo')->name('todo.')->group(function (){ |
|
26 | +if (config('easy_panel.todo')) { |
|
27 | + Route::prefix('todo')->name('todo.')->group(function() { |
|
28 | 28 | Route::get('/', \EasyPanel\Http\Livewire\Todo\Lists::class)->name('lists'); |
29 | 29 | Route::get('/create', \EasyPanel\Http\Livewire\Todo\Create::class)->name('create'); |
30 | 30 | }); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(! function_exists('getRouteName')) |
|
3 | +if (!function_exists('getRouteName')) |
|
4 | 4 | { |
5 | - function getRouteName(){ |
|
5 | + function getRouteName() { |
|
6 | 6 | $routeName = config('easy_panel.route_prefix'); |
7 | 7 | $routeName = trim($routeName, '/'); |
8 | 8 | $routeName = str_replace('/', '.', $routeName); |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | } |
11 | 11 | } |
12 | 12 | |
13 | -if(! function_exists('get_icon')) |
|
13 | +if (!function_exists('get_icon')) |
|
14 | 14 | { |
15 | - function get_icon($type){ |
|
15 | + function get_icon($type) { |
|
16 | 16 | $array = [ |
17 | 17 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
18 | 18 | 'user' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
19 | 19 | 'file' => ['files', 'file'], |
20 | 20 | 'mic' => ['episode', 'episodes', 'voices', 'voice'], |
21 | 21 | ]; |
22 | - foreach ($array as $key => $arrayValues){ |
|
23 | - if(in_array($type, $arrayValues)){ |
|
22 | + foreach ($array as $key => $arrayValues) { |
|
23 | + if (in_array($type, $arrayValues)) { |
|
24 | 24 | $val = $key; |
25 | 25 | } |
26 | 26 | } |
@@ -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'); |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | { |
25 | 25 | public function register() |
26 | 26 | { |
27 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
28 | - if(config('easy_panel.enable')) { |
|
27 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
28 | + if (config('easy_panel.enable')) { |
|
29 | 29 | $this->defineFacades(); |
30 | 30 | $this->bindCommands(); |
31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function boot() |
35 | 35 | { |
36 | - if(config('easy_panel.enable')) { |
|
36 | + if (config('easy_panel.enable')) { |
|
37 | 37 | |
38 | 38 | if (!$this->app->runningInConsole()) { |
39 | 39 | $this->registerMiddlewareAlias(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $this->loadLivewireComponent(); |
46 | 46 | } |
47 | 47 | |
48 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
48 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
49 | 49 | |
50 | 50 | $this->mergePublishes(); |
51 | 51 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | Route::prefix(config('easy_panel.route_prefix')) |
57 | 57 | ->middleware(['web', 'auth', 'isAdmin']) |
58 | - ->name(getRouteName() .'.') |
|
59 | - ->group(__DIR__ . '/routes.php'); |
|
58 | + ->name(getRouteName().'.') |
|
59 | + ->group(__DIR__.'/routes.php'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | private function defineFacades() |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | |
81 | 81 | private function mergePublishes() |
82 | 82 | { |
83 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
83 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
84 | 84 | |
85 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
85 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
86 | 86 | |
87 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__ . '/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles'); |
|
87 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/vendor/admin'), __DIR__.'/../resources/dist' => public_path('/dist/vendor/admin')], 'easy-panel-styles'); |
|
88 | 88 | |
89 | - $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'); |
|
89 | + $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'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | private function bindCommands() |