@@ -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 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | { |
36 | 36 | public function register() |
37 | 37 | { |
38 | - $this->mergeConfigFrom(__DIR__ . '/../config/easy_panel_config.php', 'easy_panel'); |
|
39 | - if(!config('easy_panel.enable')) { |
|
38 | + $this->mergeConfigFrom(__DIR__.'/../config/easy_panel_config.php', 'easy_panel'); |
|
39 | + if (!config('easy_panel.enable')) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->bindCommands(); |
45 | 45 | |
46 | 46 | foreach (config('easy_panel.actions') as $action) { |
47 | - if(!File::exists(resource_path("cruds/$action.php"))) { |
|
47 | + if (!File::exists(resource_path("cruds/$action.php"))) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | $data = require resource_path("cruds/$action.php"); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function boot() |
56 | 56 | { |
57 | - if(!config('easy_panel.enable')) { |
|
57 | + if (!config('easy_panel.enable')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Load Views |
66 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'admin'); |
|
66 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin'); |
|
67 | 67 | |
68 | 68 | // Register Middleware |
69 | 69 | $this->registerMiddlewareAlias(); |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | private function defineRoutes() |
79 | 79 | { |
80 | - if(!$this->app->routesAreCached()) { |
|
80 | + if (!$this->app->routesAreCached()) { |
|
81 | 81 | Route::prefix(config('easy_panel.route_prefix')) |
82 | 82 | ->middleware(['web', 'auth', 'isAdmin', 'LangChanger']) |
83 | - ->name(getRouteName() . '.') |
|
84 | - ->group(__DIR__ . '/routes.php'); |
|
83 | + ->name(getRouteName().'.') |
|
84 | + ->group(__DIR__.'/routes.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | |
108 | 108 | private function mergePublishes() |
109 | 109 | { |
110 | - $this->publishes([__DIR__ . '/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
110 | + $this->publishes([__DIR__.'/../config/easy_panel_config.php' => config_path('easy_panel.php')], 'easy-panel-config'); |
|
111 | 111 | |
112 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
112 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('/views/vendor/admin')], 'easy-panel-views'); |
|
113 | 113 | |
114 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
114 | + $this->publishes([__DIR__.'/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles'); |
|
115 | 115 | |
116 | - $this->publishes([__DIR__ . '/../database/migrations/2020_09_05_99999_create_todos_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_99999_create_admin_todos_table.php')], 'easy-panel-migrations'); |
|
116 | + $this->publishes([__DIR__.'/../database/migrations/2020_09_05_99999_create_todos_table.php' => base_path('/database/migrations/'.date('Y_m_d').'_99999_create_admin_todos_table.php')], 'easy-panel-migrations'); |
|
117 | 117 | |
118 | 118 | $this->publishes([__DIR__.'/../resources/lang' => resource_path('/lang')], 'easy-panel-lang'); |
119 | 119 | } |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | |
24 | 24 | public function handle() |
25 | 25 | { |
26 | - if(!$this->option('model')){ |
|
26 | + if (!$this->option('model')) { |
|
27 | 27 | $this->error("Model option must have a value"); |
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
31 | 31 | $name = strtolower($this->getNameInput()); |
32 | 32 | |
33 | - if($name != strtolower($this->option('model'))){ |
|
33 | + if ($name != strtolower($this->option('model'))) { |
|
34 | 34 | $this->warn("'{$name}' must be equal to model name"); |
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $path = resource_path("cruds/{$name}.php"); |
39 | 39 | |
40 | - if($this->files->exists($path) and !$this->option('force')){ |
|
40 | + if ($this->files->exists($path) and !$this->option('force')) { |
|
41 | 41 | $this->warn("'{$name}' already exists in CRUDs config"); |
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - if (! $this->files->isDirectory(dirname($path))) { |
|
45 | + if (!$this->files->isDirectory(dirname($path))) { |
|
46 | 46 | $this->files->makeDirectory(dirname($path), 0755, true); |
47 | 47 | } |
48 | 48 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $model = $this->qualifyModel($this->option('model')); |
78 | 78 | |
79 | - if(!class_exists($model)){ |
|
79 | + if (!class_exists($model)) { |
|
80 | 80 | $this->warn("Model option should be valid and model should be exist"); |
81 | 81 | die(); |
82 | 82 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | private function withAuth() |
88 | 88 | { |
89 | 89 | $fillableList = $this->getFillableList(); |
90 | - if(!in_array('user_id', $fillableList)){ |
|
90 | + if (!in_array('user_id', $fillableList)) { |
|
91 | 91 | return 'true'; |
92 | 92 | } |
93 | 93 | |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | { |
106 | 106 | $fillableList = $this->getFillableList(); |
107 | 107 | $array = []; |
108 | - foreach ($fillableList as $fillable){ |
|
109 | - if(!Str::contains($fillable, 'id')){ |
|
108 | + foreach ($fillableList as $fillable) { |
|
109 | + if (!Str::contains($fillable, 'id')) { |
|
110 | 110 | $array[] = "'$fillable'"; |
111 | 111 | } |
112 | 112 | } |