@@ -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, |
@@ -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'); |
@@ -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 | |
@@ -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); |
@@ -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 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $path = base_path("app/CRUD/{$name}Component.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}Component.php' already exists in CRUD directory"); |
| 29 | 29 | return; |
| 30 | 30 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $model = $this->qualifyModel($this->getNameInput()); |
| 63 | 63 | |
| 64 | - if(!class_exists($model)){ |
|
| 64 | + if (!class_exists($model)) { |
|
| 65 | 65 | $this->warn("Model option should be valid and model should be exist"); |
| 66 | 66 | die(); |
| 67 | 67 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | private function withAuth() |
| 73 | 73 | { |
| 74 | 74 | $fillableList = $this->getFillableList(); |
| 75 | - if(!in_array('user_id', $fillableList)){ |
|
| 75 | + if (!in_array('user_id', $fillableList)) { |
|
| 76 | 76 | return 'true'; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $fillableList = $this->getFillableList(); |
| 92 | 92 | $array = []; |
| 93 | - foreach ($fillableList as $fillable){ |
|
| 94 | - if(!Str::contains($fillable, 'id')){ |
|
| 93 | + foreach ($fillableList as $fillable) { |
|
| 94 | + if (!Str::contains($fillable, 'id')) { |
|
| 95 | 95 | $array[] = "'$fillable'"; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $names = (array) $this->argument('name') ?: CRUD::query()->where('active', true)->pluck('name')->toArray(); |
| 19 | 19 | |
| 20 | - if($names == null) { |
|
| 20 | + if ($names == null) { |
|
| 21 | 21 | throw new CommandNotFoundException("There is no action in database"); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | if ($this->askResult($name)) { |
| 31 | 31 | File::deleteDirectory(resource_path("/views/livewire/admin/$name")); |
| 32 | - File::deleteDirectory(app_path("/Http/Livewire/Admin/" . ucfirst($name))); |
|
| 32 | + File::deleteDirectory(app_path("/Http/Livewire/Admin/".ucfirst($name))); |
|
| 33 | 33 | File::delete(app_path("/CRUD/".ucfirst($name)."Component.php")); |
| 34 | 34 | $this->info("{$name} files were deleted, make sure you will delete {$name} value from actions in config"); |
| 35 | 35 | CRUD::query()->where('name', $name)->delete(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function askResult($name) |
| 44 | 44 | { |
| 45 | - if($this->option('force')) { |
|
| 45 | + if ($this->option('force')) { |
|
| 46 | 46 | return true; |
| 47 | 47 | } |
| 48 | 48 | $result = $this->confirm("Do you really want to delete {$name} files ?", true); |
@@ -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 = [ |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | $modelName = strtolower($this->getModelName($this->parsedModel)); |
| 218 | 218 | foreach ($fields as $value) { |
| 219 | 219 | if (!Str::contains($value, '.')) { |
| 220 | - if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
| 221 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
| 220 | + if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
| 221 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
| 222 | 222 | } else { |
| 223 | - $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 | + $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 | 224 | } |
| 225 | 225 | } else { |
| 226 | 226 | $newValue = $this->parseDots($value); |
| 227 | - $str .= '<td> {{ $' . $modelName . '->' . $newValue .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
| 227 | + $str .= '<td> {{ $'.$modelName.'->'.$newValue.' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
@@ -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 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | { |
| 288 | 288 | $array = explode('.', $field); |
| 289 | 289 | $str = ''; |
| 290 | - foreach ($array as $value){ |
|
| 290 | + foreach ($array as $value) { |
|
| 291 | 291 | $str .= ucfirst($value)." "; |
| 292 | 292 | } |
| 293 | 293 | |