@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | public function register() |
37 | 37 | { |
38 | 38 | // Here we merge config with 'easy_panel' key |
39 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
39 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
40 | 40 | |
41 | 41 | // Check the status of module |
42 | - if(!config('easy_panel.enable')) { |
|
42 | + if (!config('easy_panel.enable')) { |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function boot() |
51 | 51 | { |
52 | - if(!config('easy_panel.enable')) { |
|
52 | + if (!config('easy_panel.enable')) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->bindCommands(); |
63 | 63 | |
64 | 64 | // Load Views with 'admin::' prefix |
65 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
65 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
66 | 66 | |
67 | 67 | // Register Middleware |
68 | 68 | $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 | |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | |
113 | 113 | private function mergePublishes() |
114 | 114 | { |
115 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
115 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
116 | 116 | |
117 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
117 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
118 | 118 | |
119 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
119 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
120 | 120 | |
121 | - $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-todo'); |
|
121 | + $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-todo'); |
|
122 | 122 | |
123 | - $this->publishes([__DIR__ . '/../database/migrations/2021_07_17_99999_create_cruds_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_99999_create_cruds_table.php')], 'easy-panel-migration'); |
|
123 | + $this->publishes([__DIR__.'/../database/migrations/2021_07_17_99999_create_cruds_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_99999_create_cruds_table.php')], 'easy-panel-migration'); |
|
124 | 124 | |
125 | 125 | $this->publishes([__DIR__.'/../resources/lang' => resource_path('/lang')], 'easy-panel-lang'); |
126 | 126 |
@@ -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::checkIsAdmin(auth()->user()->id)){ |
|
19 | + if (!AuthFacade::checkIsAdmin(auth()->user()->id)) { |
|
20 | 20 | return redirect(config('easy_panel.redirect_unauthorized')); |
21 | 21 | } |
22 | 22 |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | use EasyPanel\Contracts\CRUDComponent; |
4 | 4 | |
5 | -if(! function_exists('getRouteName')) { |
|
6 | - function getRouteName(){ |
|
5 | +if (!function_exists('getRouteName')) { |
|
6 | + function getRouteName() { |
|
7 | 7 | $routeName = config('easy_panel.route_prefix'); |
8 | 8 | $routeName = trim($routeName, '/'); |
9 | 9 | $routeName = str_replace('/', '.', $routeName); |
@@ -11,19 +11,19 @@ discard block |
||
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | -if(! function_exists('getCrudConfig')) { |
|
15 | - function getCrudConfig($name){ |
|
14 | +if (!function_exists('getCrudConfig')) { |
|
15 | + function getCrudConfig($name) { |
|
16 | 16 | |
17 | - $crudName=ucfirst($name); |
|
17 | + $crudName = ucfirst($name); |
|
18 | 18 | $namespace = "\\App\\CRUD\\{$crudName}Component"; |
19 | 19 | |
20 | - if (!class_exists($namespace)){ |
|
20 | + if (!class_exists($namespace)) { |
|
21 | 21 | abort(403, "Class with {$namespace} namespace doesn't exist"); |
22 | 22 | } |
23 | 23 | |
24 | 24 | $instance = app()->make($namespace); |
25 | 25 | |
26 | - if (!$instance instanceof CRUDComponent){ |
|
26 | + if (!$instance instanceof CRUDComponent) { |
|
27 | 27 | abort(403, "{$namespace} should implement CRUDComponent interface"); |
28 | 28 | } |
29 | 29 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -if(! function_exists('crud')) { |
|
35 | - function crud($name){ |
|
34 | +if (!function_exists('crud')) { |
|
35 | + function crud($name) { |
|
36 | 36 | return \EasyPanel\Models\CRUD::query()->where('name', $name)->first(); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -if(! function_exists('get_icon')) { |
|
41 | - function get_icon($type){ |
|
40 | +if (!function_exists('get_icon')) { |
|
41 | + function get_icon($type) { |
|
42 | 42 | $array = [ |
43 | 43 | 'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'], |
44 | 44 | 'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'], |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | 'truck' => ['product', 'products', 'shops', 'shop'], |
56 | 56 | 'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'], |
57 | 57 | ]; |
58 | - foreach ($array as $key => $arrayValues){ |
|
59 | - if(in_array($type, $arrayValues)){ |
|
58 | + foreach ($array as $key => $arrayValues) { |
|
59 | + if (in_array($type, $arrayValues)) { |
|
60 | 60 | $val = $key; |
61 | 61 | } |
62 | 62 | } |