@@ -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 | } |
@@ -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 |
@@ -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 | } |
@@ -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; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | <input $mode='$name' class='form-check-input' type='checkbox' id='input$name'> |
17 | 17 | <label class='form-check-label' for='input$name'>{{ __('$UName') }}</label> |
18 | 18 | </div> |
19 | - @error('$name') <div class='invalid-feedback'>{{ " . '$message' . " }}</div> @enderror |
|
19 | + @error('$name') <div class='invalid-feedback'>{{ ".'$message'." }}</div> @enderror |
|
20 | 20 | </div> |
21 | 21 | "; |
22 | 22 | } |