@@ -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 | } |
@@ -147,18 +147,18 @@ discard block |
||
147 | 147 | { |
148 | 148 | $str = ''; |
149 | 149 | foreach ($fields as $key => $field) { |
150 | - $str .= $field != end($fields) ? "'$key' => " . '$this' . "->$key,".$this->makeTab(3) : "'$key' => " . '$this' . "->$key,"; |
|
150 | + $str .= $field != end($fields) ? "'$key' => ".'$this'."->$key,".$this->makeTab(3) : "'$key' => ".'$this'."->$key,"; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $model = $this->inputName; |
154 | - if(config("easy_panel.crud.$model.extra_values")){ |
|
154 | + if (config("easy_panel.crud.$model.extra_values")) { |
|
155 | 155 | $str .= $this->parseExtraValues(); |
156 | 156 | } |
157 | 157 | |
158 | 158 | return $str; |
159 | 159 | } |
160 | 160 | |
161 | - public function parseExtraValues(){ |
|
161 | + public function parseExtraValues() { |
|
162 | 162 | $str = ''; |
163 | 163 | |
164 | 164 | $values = $this->getConfig('extra_values'); |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $modelName = strtolower($modelName); |
177 | 177 | foreach ($fields as $value) { |
178 | 178 | if (!is_array($value)) { |
179 | - if(!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
180 | - $str .= '<td> {{ $' . $modelName . '->' . $value . " }} </td>" . $this->makeTab(1, end($fields) != $value); |
|
179 | + if (!in_array($value, ['image', 'photo', 'profile', 'banner'])) { |
|
180 | + $str .= '<td> {{ $'.$modelName.'->'.$value." }} </td>".$this->makeTab(1, end($fields) != $value); |
|
181 | 181 | } else { |
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); |
|
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 | 184 | } else { |
185 | 185 | $relationName = array_key_first($value); |
186 | - $str .= '<td> {{ $' . $modelName . '->' . $relationName . '->'. $value[array_key_first($value)] .' }} </td>' . $this->makeTab(1, end($fields) != $value); |
|
186 | + $str .= '<td> {{ $'.$modelName.'->'.$relationName.'->'.$value[array_key_first($value)].' }} </td>'.$this->makeTab(1, end($fields) != $value); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $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); |
202 | 202 | } else { |
203 | 203 | $relationName = array_key_first($field); |
204 | - $field = ucfirst($relationName). ' ' . ucfirst($field[array_key_first($field)]); |
|
204 | + $field = ucfirst($relationName).' '.ucfirst($field[array_key_first($field)]); |
|
205 | 205 | $str .= "<td> {{ __('$field') }} </td>".$this->makeTab(6, end($fields) != $field); |
206 | 206 | } |
207 | 207 | $this->texts[$field] = $field; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | return $str; |
225 | 225 | } |
226 | 226 | |
227 | - public function makeTab($count, $newLine = true){ |
|
227 | + public function makeTab($count, $newLine = true) { |
|
228 | 228 | $count = $count * 4; |
229 | 229 | $tabs = str_repeat(' ', $count); |
230 | 230 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $this->type = $type; |
25 | 25 | } |
26 | 26 | |
27 | - public function render(){ |
|
27 | + public function render() { |
|
28 | 28 | $name = $this->name; |
29 | 29 | |
30 | 30 | // Create an instance of input class |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | $names = $this->argument('name') ? [$this->argument('name')] : config('easy_panel.actions', []); |
18 | 18 | |
19 | - if(is_null($names)) { |
|
19 | + if (is_null($names)) { |
|
20 | 20 | throw new CommandNotFoundException("There is no action in config file"); |
21 | 21 | } |
22 | 22 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $model = explode('\\', $model); |
41 | 41 | $model = strtolower(end($model)); |
42 | 42 | |
43 | - if($model != $name){ |
|
43 | + if ($model != $name) { |
|
44 | 44 | throw new CommandNotFoundException("Action key should be equal to model name, You are using {$name} as key name but your model name is {$model}"); |
45 | 45 | } |
46 | 46 | } |
@@ -21,26 +21,26 @@ discard block |
||
21 | 21 | |
22 | 22 | public function handle() |
23 | 23 | { |
24 | - if(!$this->option('model')){ |
|
24 | + if (!$this->option('model')) { |
|
25 | 25 | $this->error("Model option must have a value"); |
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | 29 | $name = strtolower($this->getNameInput()); |
30 | 30 | |
31 | - if($name != strtolower($this->option('model'))){ |
|
31 | + if ($name != strtolower($this->option('model'))) { |
|
32 | 32 | $this->warn("'{$name}' must be equal to model name"); |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | 36 | $path = resource_path("cruds/{$name}.php"); |
37 | 37 | |
38 | - if($this->files->exists($path) and !$this->option('force')){ |
|
38 | + if ($this->files->exists($path) and !$this->option('force')) { |
|
39 | 39 | $this->warn("'{$name}' already exists in CRUDs config"); |
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - if (! $this->files->isDirectory(dirname($path))) { |
|
43 | + if (!$this->files->isDirectory(dirname($path))) { |
|
44 | 44 | $this->files->makeDirectory(dirname($path), 0755, true); |
45 | 45 | } |
46 | 46 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $model = $this->qualifyModel($this->option('model')); |
57 | 57 | |
58 | - if(!class_exists($model)){ |
|
58 | + if (!class_exists($model)) { |
|
59 | 59 | $this->warn("Model option should be valid and model should be exist"); |
60 | 60 | die(); |
61 | 61 | } |
@@ -38,17 +38,17 @@ |
||
38 | 38 | |
39 | 39 | protected function getStub() |
40 | 40 | { |
41 | - return __DIR__ . "/../stub/{$this->file}.stub"; |
|
41 | + return __DIR__."/../stub/{$this->file}.stub"; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | private function buildBlade() |
45 | 45 | { |
46 | - $stub = $this->files->get(__DIR__ . "/../stub/blade/{$this->file}.blade.stub"); |
|
46 | + $stub = $this->files->get(__DIR__."/../stub/blade/{$this->file}.blade.stub"); |
|
47 | 47 | $newStub = $this->stubParser->parseBlade($stub); |
48 | 48 | |
49 | 49 | $path = $this->viewPath("livewire/admin/{$this->getNameInput()}/{$this->file}.blade.php"); |
50 | 50 | |
51 | - if (! $this->files->isDirectory(dirname($path))) { |
|
51 | + if (!$this->files->isDirectory(dirname($path))) { |
|
52 | 52 | $this->files->makeDirectory(dirname($path), 0755, true); |
53 | 53 | } |
54 | 54 |
@@ -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 | }); |