@@ -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, |
@@ -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 | } |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | public function handle() |
| 16 | 16 | { |
| 17 | 17 | $user = $this->argument('user'); |
| 18 | - try{ |
|
| 18 | + try { |
|
| 19 | 19 | $status = UserProviderFacade::makeAdmin($user); |
| 20 | - if($status){ |
|
| 20 | + if ($status) { |
|
| 21 | 21 | $this->info("User {$user} was converted to an admin"); |
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | $this->warn("It was failed, be sure your column is fillable."); |
| 25 | - } catch (\Exception $exception){ |
|
| 25 | + } catch (\Exception $exception) { |
|
| 26 | 26 | $this->error("User {$user} does not exist"); |
| 27 | 27 | } |
| 28 | 28 | } |