@@ -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 | return; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function askResult($user) |
31 | 31 | { |
32 | - if($this->option('force')) { |
|
32 | + if ($this->option('force')) { |
|
33 | 33 | return true; |
34 | 34 | } |
35 | 35 | $result = $this->confirm("Do you want to remove {$user} from administration", 'yes'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function handle() |
17 | 17 | { |
18 | 18 | $names = (array) $this->argument('name') ?: 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 will delete {$name} value from actions in config"); |
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 ?", true); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | $names = $this->argument('name') ? [$this->argument('name')] : config('easy_panel.actions', []); |
18 | 18 | |
19 | - if(is_null($names)) { |
|
19 | + if (is_null($names)) { |
|
20 | 20 | throw new CommandNotFoundException("There is no action in config file"); |
21 | 21 | } |
22 | 22 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $model = explode('\\', $model); |
41 | 41 | $model = strtolower(end($model)); |
42 | 42 | |
43 | - if($model != $name){ |
|
43 | + if ($model != $name) { |
|
44 | 44 | throw new CommandNotFoundException("Action key should be equal to model name, You are using {$name} as key name but your model name is {$model}"); |
45 | 45 | } |
46 | 46 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | ? true |
18 | 18 | : $this->confirm("Do you really want to uninstall the panel ? (All files and components will be deleted)", true); |
19 | 19 | |
20 | - if($status){ |
|
20 | + if ($status) { |
|
21 | 21 | File::deleteDirectory(app_path('Http/Livewire/Admin')); |
22 | 22 | File::deleteDirectory(resource_path('views/livewire/admin')); |
23 | 23 | File::deleteDirectory(resource_path('views/vendor/admin')); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function handle() |
15 | 15 | { |
16 | 16 | $status = $this->confirm("Do you really want to reinstall the panel ? (All components will be deleted)", true); |
17 | - if($status) { |
|
17 | + if ($status) { |
|
18 | 18 | Artisan::call("panel:uninstall", [ |
19 | 19 | '--force' => true, |
20 | 20 | ]); |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | |
25 | 25 | $path = resource_path("cruds/{$name}.php"); |
26 | 26 | |
27 | - if($this->files->exists($path) and !$this->option('force')){ |
|
27 | + if ($this->files->exists($path) and !$this->option('force')) { |
|
28 | 28 | $this->warn("'{$name}.php' already exists in CRUDs config"); |
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - if (! $this->files->isDirectory(dirname($path))) { |
|
32 | + if (!$this->files->isDirectory(dirname($path))) { |
|
33 | 33 | $this->files->makeDirectory(dirname($path), 0755, true); |
34 | 34 | } |
35 | 35 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $model = $this->qualifyModel($this->getNameInput()); |
64 | 64 | |
65 | - if(!class_exists($model)){ |
|
65 | + if (!class_exists($model)) { |
|
66 | 66 | $this->warn("Model option should be valid and model should be exist"); |
67 | 67 | die(); |
68 | 68 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | private function withAuth() |
74 | 74 | { |
75 | 75 | $fillableList = $this->getFillableList(); |
76 | - if(!in_array('user_id', $fillableList)){ |
|
76 | + if (!in_array('user_id', $fillableList)) { |
|
77 | 77 | return 'true'; |
78 | 78 | } |
79 | 79 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | { |
92 | 92 | $fillableList = $this->getFillableList(); |
93 | 93 | $array = []; |
94 | - foreach ($fillableList as $fillable){ |
|
95 | - if(!Str::contains($fillable, 'id')){ |
|
94 | + foreach ($fillableList as $fillable) { |
|
95 | + if (!Str::contains($fillable, 'id')) { |
|
96 | 96 | $array[] = "'$fillable'"; |
97 | 97 | } |
98 | 98 | } |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | public function register() |
38 | 38 | { |
39 | 39 | // Here we merge config with 'easy_panel' key |
40 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
40 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
41 | 41 | |
42 | 42 | // Check the status of module |
43 | - if(!config('easy_panel.enable')) { |
|
43 | + if (!config('easy_panel.enable')) { |
|
44 | 44 | return; |
45 | 45 | } |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function boot() |
52 | 52 | { |
53 | - if(!config('easy_panel.enable')) { |
|
53 | + if (!config('easy_panel.enable')) { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
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(); |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | private function defineRoutes() |
80 | 80 | { |
81 | - if(!$this->app->routesAreCached()) { |
|
81 | + if (!$this->app->routesAreCached()) { |
|
82 | 82 | Route::prefix(config('easy_panel.route_prefix')) |
83 | 83 | ->middleware(['web', 'isAdmin', 'LangChanger']) |
84 | - ->name(getRouteName() . '.') |
|
85 | - ->group(__DIR__ . '/routes.php'); |
|
84 | + ->name(getRouteName().'.') |
|
85 | + ->group(__DIR__.'/routes.php'); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | |
109 | 109 | private function mergePublishes() |
110 | 110 | { |
111 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
111 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
112 | 112 | |
113 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
113 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
114 | 114 | |
115 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
115 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
116 | 116 | |
117 | - $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'); |
|
117 | + $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'); |
|
118 | 118 | |
119 | 119 | $this->publishes([__DIR__.'/../resources/lang' => resource_path('/lang')], 'easy-panel-lang'); |
120 | 120 |
@@ -10,11 +10,11 @@ |
||
10 | 10 | |
11 | 11 | public function handle($request, Closure $next) |
12 | 12 | { |
13 | - if(auth()->guest()){ |
|
13 | + if (auth()->guest()) { |
|
14 | 14 | return redirect(config('easy_panel.redirect_unauthorized')); |
15 | 15 | } |
16 | 16 | |
17 | - if(!AuthFacade::checkIsAdmin(auth()->user()->id)){ |
|
17 | + if (!AuthFacade::checkIsAdmin(auth()->user()->id)) { |
|
18 | 18 | return redirect(config('easy_panel.redirect_unauthorized')); |
19 | 19 | } |
20 | 20 |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | $this->store = $store; |
36 | 36 | } |
37 | 37 | |
38 | - public function setAuthType(bool $hasAuth){ |
|
38 | + public function setAuthType(bool $hasAuth) { |
|
39 | 39 | $this->hasAuth = $hasAuth; |
40 | 40 | } |
41 | 41 | |
42 | - public function setFields(array $fields){ |
|
42 | + public function setFields(array $fields) { |
|
43 | 43 | $this->fields = $fields; |
44 | 44 | } |
45 | 45 | |
46 | - public function setInputs(array $inputs){ |
|
46 | + public function setInputs(array $inputs) { |
|
47 | 47 | $this->inputs = $inputs; |
48 | 48 | } |
49 | 49 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $decodedFile = json_decode(File::get($file), 1); |
82 | 82 | $texts = $this->texts; |
83 | 83 | foreach ($texts as $key => $text) { |
84 | - if (array_key_exists($key, $decodedFile)){ |
|
84 | + if (array_key_exists($key, $decodedFile)) { |
|
85 | 85 | unset($texts[$text]); |
86 | 86 | } |
87 | 87 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $fields = array_keys($this->inputs); |
109 | 109 | $str = ''; |
110 | 110 | |
111 | - if(in_array($this->inputName, $fields)){ |
|
111 | + if (in_array($this->inputName, $fields)) { |
|
112 | 112 | $this->error("Model name must not equal to column names, fix it and rerun command with -f flag"); |
113 | 113 | die; |
114 | 114 | } |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | |
180 | 180 | foreach ($this->inputs as $key => $field) { |
181 | 181 | $newLine = ($field != end($this->inputs) or $this->hasAuth); |
182 | - $str .= "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine); |
|
182 | + $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine); |
|
183 | 183 | } |
184 | 184 | |
185 | - if($this->hasAuth){ |
|
185 | + if ($this->hasAuth) { |
|
186 | 186 | $str .= "'user_id' => auth()->id(),"; |
187 | 187 | } |
188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | /** |
193 | 193 | * Create Blade from stub |
194 | 194 | */ |
195 | - public function parseBlade($stub){ |
|
195 | + public function parseBlade($stub) { |
|
196 | 196 | $modelName = $this->getModelName($this->parsedModel); |
197 | 197 | |
198 | 198 | $array = [ |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | $modelName = strtolower($this->getModelName($this->parsedModel)); |
219 | 219 | foreach ($fields as $value) { |
220 | 220 | if (!is_array($value)) { |
221 | - if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
222 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
221 | + if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
222 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
223 | 223 | } else { |
224 | - $str .= '<td><a target="_blank" href="{{ asset($' . $modelName . '->' . $value . ') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($' . $modelName . '->' . $value . ') }}" alt="'.$value.'"></a></td>' . $this->makeTab(1, end($fields) != $value); |
|
224 | + $str .= '<td><a target="_blank" href="{{ asset($'.$modelName.'->'.$value.') }}"><img class="rounded-circle img-fluid" width="50" height="50" src="{{ asset($'.$modelName.'->'.$value.') }}" alt="'.$value.'"></a></td>'.$this->makeTab(1, end($fields) != $value); |
|
225 | 225 | } |
226 | 226 | } else { |
227 | 227 | $relationName = array_key_first($value); |
228 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
228 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $str .= "<td style='cursor: pointer' wire:click=\"sort('$sortName')\"> <i class='fa @if(".'$sortType'." == 'desc' and ".'$sortColumn'." == '$sortName') fa-sort-amount-down ml-2 @elseif(".'$sortType == '."'asc' and ".'$sortColumn'." == '$sortName') fa-sort-amount-up ml-2 @endif'></i> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field); |
247 | 247 | } else { |
248 | 248 | $relationName = array_key_first($field); |
249 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
249 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
250 | 250 | $str .= "<td> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field); |
251 | 251 | } |
252 | 252 | $this->texts[$field] = $field; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | /** |
274 | 274 | * Tab Maker (Each tabs mean 4 space) |
275 | 275 | */ |
276 | - public function makeTab($count, $newLine = true){ |
|
276 | + public function makeTab($count, $newLine = true) { |
|
277 | 277 | $count = $count * 4; |
278 | 278 | $tabs = str_repeat(' ', $count); |
279 | 279 |