@@ -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'); |
@@ -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 | }); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function delete() |
33 | 33 | { |
34 | 34 | $this->todo->delete(); |
35 | - $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Todo') ] )]); |
|
35 | + $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Todo')])]); |
|
36 | 36 | $this->emit('todoDeleted'); |
37 | 37 | } |
38 | 38 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | $this->validate(); |
25 | 25 | $this->emit('todoCreated'); |
26 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Todo') ])]); |
|
26 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Todo')])]); |
|
27 | 27 | |
28 | 28 | Todo::create([ |
29 | 29 | 'title' => $this->title, |
@@ -181,7 +181,7 @@ |
||
181 | 181 | } else { |
182 | 182 | $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); |
183 | 183 | } |
184 | - } else { |
|
184 | + } else { |
|
185 | 185 | $relationName = array_key_first($value); |
186 | 186 | $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
187 | 187 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $decodedFile = json_decode(File::get($file), 1); |
51 | 51 | $texts = $this->texts; |
52 | 52 | foreach ($texts as $key => $text) { |
53 | - if (array_key_exists($key, $decodedFile)){ |
|
53 | + if (array_key_exists($key, $decodedFile)) { |
|
54 | 54 | unset($texts[$text]); |
55 | 55 | } |
56 | 56 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - public function parseBlade($stub){ |
|
62 | + public function parseBlade($stub) { |
|
63 | 63 | $modelName = $this->getModelName($this->parsedModel); |
64 | 64 | |
65 | 65 | $array = [ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return str_replace(array_keys($array), array_values($array), $stub); |
76 | 76 | } |
77 | 77 | |
78 | - public function getConfig($key, $action = null){ |
|
78 | + public function getConfig($key, $action = null) { |
|
79 | 79 | $action = $action ?? $this->inputName; |
80 | 80 | |
81 | 81 | return config("easy_panel.crud.$action.$key") ?: []; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $fields = array_keys($fields); |
94 | 94 | $str = ''; |
95 | 95 | |
96 | - if(in_array($this->inputName, $fields)){ |
|
96 | + if (in_array($this->inputName, $fields)) { |
|
97 | 97 | $this->error("Model name must not equal to column names, fix it and rerun command with -f flag"); |
98 | 98 | die; |
99 | 99 | } |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | |
154 | 154 | foreach ($fields as $key => $field) { |
155 | 155 | $newLine = ($field != end($fields) or $this->getConfig('with_auth')); |
156 | - $str .= "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine); |
|
156 | + $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine); |
|
157 | 157 | } |
158 | 158 | |
159 | - if($this->getConfig('with_auth')){ |
|
159 | + if ($this->getConfig('with_auth')) { |
|
160 | 160 | $str .= "'user_id' => auth()->id(),"; |
161 | 161 | } |
162 | 162 | |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | $modelName = strtolower($modelName); |
171 | 171 | foreach ($fields as $value) { |
172 | 172 | if (!is_array($value)) { |
173 | - if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
174 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
173 | + if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
174 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
175 | 175 | } else { |
176 | - $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); |
|
176 | + $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); |
|
177 | 177 | } |
178 | 178 | } else { |
179 | 179 | $relationName = array_key_first($value); |
180 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
180 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $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); |
196 | 196 | } else { |
197 | 197 | $relationName = array_key_first($field); |
198 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
198 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
199 | 199 | $str .= "<td> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field); |
200 | 200 | } |
201 | 201 | $this->texts[$field] = $field; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | return $str; |
219 | 219 | } |
220 | 220 | |
221 | - public function makeTab($count, $newLine = true){ |
|
221 | + public function makeTab($count, $newLine = true) { |
|
222 | 222 | $count = $count * 4; |
223 | 223 | $tabs = str_repeat(' ', $count); |
224 | 224 |
@@ -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'], |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | 'truck' => ['product', 'products', 'shops', 'shop'], |
28 | 28 | 'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'], |
29 | 29 | ]; |
30 | - foreach ($array as $key => $arrayValues){ |
|
31 | - if(in_array($type, $arrayValues)){ |
|
30 | + foreach ($array as $key => $arrayValues) { |
|
31 | + if (in_array($type, $arrayValues)) { |
|
32 | 32 | $val = $key; |
33 | 33 | } |
34 | 34 | } |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if(! function_exists('registerActionRoutes')){ |
|
39 | +if (!function_exists('registerActionRoutes')) { |
|
40 | 40 | function registerActionRoutes($action, $component, $crudConfig) |
41 | 41 | { |
42 | - Route::prefix($action)->name("$action.")->group(function () use ($component, $crudConfig, $action) { |
|
42 | + Route::prefix($action)->name("$action.")->group(function() use ($component, $crudConfig, $action) { |
|
43 | 43 | |
44 | - if(@class_exists("$component\\Read")) { |
|
44 | + if (@class_exists("$component\\Read")) { |
|
45 | 45 | Route::get('/', "$component\\Read")->name('read'); |
46 | 46 | } |
47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | if (@$crudConfig['update'] and @class_exists("$component\\Update")) { |
53 | - Route::get('/update/{' . $action . '}', "$component\\Update")->name('update'); |
|
53 | + Route::get('/update/{'.$action.'}', "$component\\Update")->name('update'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | }); |
@@ -8,8 +8,8 @@ |
||
8 | 8 | public function handle($name, $values, $action) |
9 | 9 | { |
10 | 10 | return "<select wire:model='$name' class=\"form-control @error('$name') is-invalid @enderror\" id='input$name'> |
11 | - @foreach(config('easy_panel.crud.$action.fields.$name')['select'] as " . '$key => $value' . ") |
|
12 | - <option value='{{ " . '$key' . " }}'>{{ " . '$value' . " }}</option> |
|
11 | + @foreach(config('easy_panel.crud.$action.fields.$name')['select'] as ".'$key => $value'.") |
|
12 | + <option value='{{ " . '$key'." }}'>{{ ".'$value'." }}</option> |
|
13 | 13 | @endforeach |
14 | 14 | </select>"; |
15 | 15 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public function handle($request, Closure $next) |
12 | 12 | { |
13 | - if(!AuthFacade::checkIsAdmin(auth()->user()->id)){ |
|
13 | + if (!AuthFacade::checkIsAdmin(auth()->user()->id)) { |
|
14 | 14 | return redirect(config('easy_panel.redirect_unauthorized')); |
15 | 15 | } |
16 | 16 |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | $this->action = $action; |
29 | 29 | } |
30 | 30 | |
31 | - public function render(){ |
|
31 | + public function render() { |
|
32 | 32 | $name = $this->name; |
33 | 33 | |
34 | 34 | // Create an instance of input class |
35 | 35 | // then call handle() method to get input as a steing |
36 | - if(!is_array($this->type)) { |
|
36 | + if (!is_array($this->type)) { |
|
37 | 37 | $inputStringClass = static::classMap[$this->type]; |
38 | 38 | $input = (new $inputStringClass())->handle($name); |
39 | 39 | } else { |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | // render all input element |
47 | - if($this->type != 'checkbox') { |
|
47 | + if ($this->type != 'checkbox') { |
|
48 | 48 | $title = ucfirst($name); |
49 | 49 | $str = " |
50 | 50 | <!-- $title Input --> |
51 | 51 | <div class='form-group'> |
52 | 52 | <label for='input$name' class='col-sm-2 control-label'> {{ __('$title') }}</label> |
53 | 53 | $input |
54 | - @error('$name') <div class='invalid-feedback'>{{ " . '$message' . " }}</div> @enderror |
|
54 | + @error('$name') <div class='invalid-feedback'>{{ ".'$message'." }}</div> @enderror |
|
55 | 55 | </div> |
56 | 56 | "; |
57 | 57 | return $str; |