@@ -12,7 +12,7 @@ |
||
12 | 12 | $user = $this->findUser($id); |
13 | 13 | $modelInstance = app()->make(config('easy_panel.user_model')); |
14 | 14 | $column = config('easy_panel.column'); |
15 | - if(in_array($column, $modelInstance->getFillable()) or !in_array($column, $modelInstance->getGuarded())) { |
|
15 | + if (in_array($column, $modelInstance->getFillable()) or !in_array($column, $modelInstance->getGuarded())) { |
|
16 | 16 | $user->update([ |
17 | 17 | config('easy_panel.column') => 1 |
18 | 18 | ]); |
@@ -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,20 +26,20 @@ 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 | }); |
@@ -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,11 +76,11 @@ discard block |
||
76 | 76 | |
77 | 77 | private function defineRoutes() |
78 | 78 | { |
79 | - if(!$this->app->routesAreCached()) { |
|
79 | + if (!$this->app->routesAreCached()) { |
|
80 | 80 | Route::prefix(config('easy_panel.route_prefix')) |
81 | 81 | ->middleware(['web', 'isAdmin', 'LangChanger']) |
82 | - ->name(getRouteName() . '.') |
|
83 | - ->group(__DIR__ . '/routes.php'); |
|
82 | + ->name(getRouteName().'.') |
|
83 | + ->group(__DIR__.'/routes.php'); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | |
111 | 111 | private function mergePublishes() |
112 | 112 | { |
113 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
113 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
114 | 114 | |
115 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
115 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
116 | 116 | |
117 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
117 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
118 | 118 | |
119 | - $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'); |
|
119 | + $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'); |
|
120 | 120 | |
121 | - $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'); |
|
121 | + $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'); |
|
122 | 122 | |
123 | 123 | $this->publishes([__DIR__.'/../resources/lang' => resource_path('/lang')], 'easy-panel-lang'); |
124 | 124 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ]); |
25 | 25 | |
26 | 26 | $this->crud->delete(); |
27 | - $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Todo') ] )]); |
|
27 | + $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Todo')])]); |
|
28 | 28 | $this->emit('crudUpdated'); |
29 | 29 | } |
30 | 30 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'built' => true |
40 | 40 | ]); |
41 | 41 | |
42 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully') ] ); |
|
42 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully')]); |
|
43 | 43 | $this->emit('crudUpdated'); |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'active' => false |
50 | 50 | ]); |
51 | 51 | |
52 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated') ] ); |
|
52 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated')]); |
|
53 | 53 | $this->emit('crudUpdated'); |
54 | 54 | } |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'active' => true |
60 | 60 | ]); |
61 | 61 | |
62 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated') ] ); |
|
62 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated')]); |
|
63 | 63 | $this->emit('crudUpdated'); |
64 | 64 | } |
65 | 65 |
@@ -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 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $decodedFile = json_decode(File::get($file), 1); |
80 | 80 | $texts = $this->texts; |
81 | 81 | foreach ($texts as $key => $text) { |
82 | - if (array_key_exists($key, $decodedFile)){ |
|
82 | + if (array_key_exists($key, $decodedFile)) { |
|
83 | 83 | unset($texts[$text]); |
84 | 84 | } |
85 | 85 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $fields = array_keys($this->inputs); |
107 | 107 | $str = ''; |
108 | 108 | |
109 | - if(in_array($this->inputName, $fields)){ |
|
109 | + if (in_array($this->inputName, $fields)) { |
|
110 | 110 | $this->error("Model name must not equal to column names, fix it and rerun command with -f flag"); |
111 | 111 | die; |
112 | 112 | } |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | |
178 | 178 | foreach ($this->inputs as $key => $field) { |
179 | 179 | $newLine = ($field != end($this->inputs) or $this->hasAuth); |
180 | - $str .= "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine); |
|
180 | + $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine); |
|
181 | 181 | } |
182 | 182 | |
183 | - if($this->hasAuth){ |
|
183 | + if ($this->hasAuth) { |
|
184 | 184 | $str .= "'user_id' => auth()->id(),"; |
185 | 185 | } |
186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /** |
191 | 191 | * Create Blade from stub |
192 | 192 | */ |
193 | - public function parseBlade($stub){ |
|
193 | + public function parseBlade($stub) { |
|
194 | 194 | $modelName = $this->getModelName($this->parsedModel); |
195 | 195 | |
196 | 196 | $array = [ |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | $modelName = strtolower($this->getModelName($this->parsedModel)); |
217 | 217 | foreach ($fields as $value) { |
218 | 218 | if (!is_array($value)) { |
219 | - if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
220 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
219 | + if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
220 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
221 | 221 | } else { |
222 | - $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); |
|
222 | + $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); |
|
223 | 223 | } |
224 | 224 | } else { |
225 | 225 | $relationName = array_key_first($value); |
226 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
226 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $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); |
245 | 245 | } else { |
246 | 246 | $relationName = array_key_first($field); |
247 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
247 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
248 | 248 | $str .= "<td> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field); |
249 | 249 | } |
250 | 250 | $this->texts[$field] = $field; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | /** |
272 | 272 | * Tab Maker (Each tabs mean 4 space) |
273 | 273 | */ |
274 | - public function makeTab($count, $newLine = true){ |
|
274 | + public function makeTab($count, $newLine = true) { |
|
275 | 275 | $count = $count * 4; |
276 | 276 | $tabs = str_repeat(' ', $count); |
277 | 277 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | ]; |
100 | 100 | } |
101 | 101 | |
102 | - private function setCRUDInstance(){ |
|
102 | + private function setCRUDInstance() { |
|
103 | 103 | $modelName = $this->getNameInput(); |
104 | 104 | |
105 | 105 | return $this->crudInstance = getCrudConfig($modelName); |
@@ -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(app_path('CRUD')); |
23 | 23 | File::deleteDirectory(resource_path('views/livewire/admin')); |
@@ -15,10 +15,9 @@ |
||
15 | 15 | public function handle() |
16 | 16 | { |
17 | 17 | $names = $this->argument('name') ? |
18 | - [$this->argument('name')] : |
|
19 | - CRUD::query()->where('active', true)->pluck('name')->toArray(); |
|
18 | + [$this->argument('name')] : CRUD::query()->where('active', true)->pluck('name')->toArray(); |
|
20 | 19 | |
21 | - if(is_null($names)) { |
|
20 | + if (is_null($names)) { |
|
22 | 21 | throw new CommandNotFoundException("There is no action in config file"); |
23 | 22 | } |
24 | 23 |
@@ -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(); |