@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function scopeSearch(Builder $builder, string $term = '') |
| 10 | 10 | { |
| 11 | - if (! $this->searchable) { |
|
| 11 | + if (!$this->searchable) { |
|
| 12 | 12 | throw new Exception('Please define the searchable property . '); |
| 13 | 13 | } |
| 14 | 14 | foreach ($this->searchable as $searchable) { |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $exclude_website_models = getAllModelNames(app_path('Models/Admin/Website')); |
| 47 | 47 | $models = getAllModelNames(app_path($path)); |
| 48 | 48 | foreach ($models as $name) { |
| 49 | - if (Schema::hasTable(Str::plural($name)) && ! in_array($name, $excluded_models ?? []) && ! in_array($name, $exclude_website_models ?? [])) { |
|
| 49 | + if (Schema::hasTable(Str::plural($name)) && !in_array($name, $excluded_models ?? []) && !in_array($name, $exclude_website_models ?? [])) { |
|
| 50 | 50 | $path = $this->getModelPath($name); |
| 51 | 51 | $version = $this->option('v'); |
| 52 | 52 | if ($this->option('rest')) { |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | 'message' => $error, |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | - if (! empty($errorMessages)) { |
|
| 43 | + if (!empty($errorMessages)) { |
|
| 44 | 44 | $response['data'] = $errorMessages; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -25,10 +25,10 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function preferenceChanged(User $user, Preference $preference) |
| 27 | 27 | { |
| 28 | - $user->preferences()->updateExistingPivot($preference->id, ['enabled' => ! $this->enabled], false); |
|
| 28 | + $user->preferences()->updateExistingPivot($preference->id, ['enabled' => !$this->enabled], false); |
|
| 29 | 29 | |
| 30 | 30 | $this->preference = $preference; |
| 31 | - $this->enabled = ! $this->enabled; |
|
| 31 | + $this->enabled = !$this->enabled; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function render() |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function deleteWithLimit() |
| 55 | 55 | { |
| 56 | - if (! is_null($this->delete_limit)) { |
|
| 56 | + if (!is_null($this->delete_limit)) { |
|
| 57 | 57 | Activity::whereDate('created_at', '<', Carbon::now()->subDays($this->delete_limit))->delete(); |
| 58 | 58 | $this->emit('activity_success', 'All activities Deleted except last '.$this->delete_limit.'days activities'); |
| 59 | 59 | } |
@@ -97,19 +97,19 @@ discard block |
||
| 97 | 97 | $this->resetPage(); |
| 98 | 98 | $data = Activity::query(); |
| 99 | 99 | // Filter By Log Name |
| 100 | - if (! is_null($this->log_name)) { |
|
| 100 | + if (!is_null($this->log_name)) { |
|
| 101 | 101 | $data = $data->where('log_name', $this->log_name); |
| 102 | 102 | } |
| 103 | 103 | // Filter By Model |
| 104 | - if (! is_null($this->model)) { |
|
| 104 | + if (!is_null($this->model)) { |
|
| 105 | 105 | $data = $data->where('subject_type', $this->model); |
| 106 | 106 | } |
| 107 | 107 | // Filter By User |
| 108 | - if (! is_null($this->user_id)) { |
|
| 108 | + if (!is_null($this->user_id)) { |
|
| 109 | 109 | $data = $data->where('causer_id', $this->user_id); |
| 110 | 110 | } |
| 111 | 111 | // Filter By Date |
| 112 | - if (! is_null($this->start_date) && ! is_null($this->end_date)) { |
|
| 112 | + if (!is_null($this->start_date) && !is_null($this->end_date)) { |
|
| 113 | 113 | $data = $data->whereDate('created_at', [$this->start_date, $this->end_date]); |
| 114 | 114 | } |
| 115 | 115 | $this->activity_count = with($data)->count(); |
@@ -2,14 +2,14 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Pratiksh\Adminetic\Models\Admin\Setting; |
| 4 | 4 | |
| 5 | -if (! function_exists('spa')) { |
|
| 5 | +if (!function_exists('spa')) { |
|
| 6 | 6 | function spa() |
| 7 | 7 | { |
| 8 | 8 | return setting('spa', config('adminetic.spa', true)); |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -if (! function_exists('getClassesList')) { |
|
| 12 | +if (!function_exists('getClassesList')) { |
|
| 13 | 13 | function getClassesList($dir) |
| 14 | 14 | { |
| 15 | 15 | $classes = \File::allFiles($dir); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | return $classes; |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | -if (! function_exists('getAllModelNames')) { |
|
| 27 | +if (!function_exists('getAllModelNames')) { |
|
| 28 | 28 | function getAllModelNames($dir) |
| 29 | 29 | { |
| 30 | 30 | $modelNames = []; |
@@ -38,42 +38,42 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if (! function_exists('validImageFolder')) { |
|
| 41 | +if (!function_exists('validImageFolder')) { |
|
| 42 | 42 | function validImageFolder($name, $default = 'default') |
| 43 | 43 | { |
| 44 | 44 | return strtolower(str_replace([' ', '-', '$', '<', '>', '&', '{', $closing_token, '*', '\\', '/', ':', '.', ';', ',', "'", '"'], '_', $name ?? trim($default))); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -if (! function_exists('getImagePlaceholder')) { |
|
| 48 | +if (!function_exists('getImagePlaceholder')) { |
|
| 49 | 49 | function getImagePlaceholder() |
| 50 | 50 | { |
| 51 | 51 | return asset('adminetic/static/placeholder.png'); |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -if (! function_exists('getVerticalImagePlaceholder')) { |
|
| 55 | +if (!function_exists('getVerticalImagePlaceholder')) { |
|
| 56 | 56 | function getVerticalImagePlaceholder() |
| 57 | 57 | { |
| 58 | 58 | return asset('adminetic/static/vertical_placeholder.jpg'); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -if (! function_exists('getSliderPlaceholder')) { |
|
| 62 | +if (!function_exists('getSliderPlaceholder')) { |
|
| 63 | 63 | function getSliderPlaceholder() |
| 64 | 64 | { |
| 65 | 65 | return asset('adminetic/static/slider.jpg'); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -if (! function_exists('getFoodImagePlaceholder')) { |
|
| 69 | +if (!function_exists('getFoodImagePlaceholder')) { |
|
| 70 | 70 | function getFoodImagePlaceholder() |
| 71 | 71 | { |
| 72 | 72 | return asset('adminetic/static/food_placeholder.jpg'); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -if (! function_exists('getProfilePlaceholder')) { |
|
| 76 | +if (!function_exists('getProfilePlaceholder')) { |
|
| 77 | 77 | function getProfilePlaceholder($p = null) |
| 78 | 78 | { |
| 79 | 79 | $profile = $p ?? Auth::user()->profile ?? Auth::user()->profile()->create(); |
@@ -82,77 +82,77 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -if (! function_exists('title')) { |
|
| 85 | +if (!function_exists('title')) { |
|
| 86 | 86 | function title() |
| 87 | 87 | { |
| 88 | 88 | return setting('title', config('adminetic.name', 'Adminetic')); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -if (! function_exists('loader_enabled')) { |
|
| 92 | +if (!function_exists('loader_enabled')) { |
|
| 93 | 93 | function loader_enabled() |
| 94 | 94 | { |
| 95 | 95 | return setting('loader_enabled', config('adminetic.loader_enabled', true)); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | -if (! function_exists('favicon')) { |
|
| 99 | +if (!function_exists('favicon')) { |
|
| 100 | 100 | function favicon() |
| 101 | 101 | { |
| 102 | - return getImg(! is_null(setting('favicon')) ? setting('favicon') : 'adminetic/static/favicon.png', 'adminetic/static/favicon.png'); |
|
| 102 | + return getImg(!is_null(setting('favicon')) ? setting('favicon') : 'adminetic/static/favicon.png', 'adminetic/static/favicon.png'); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | -if (! function_exists('logo')) { |
|
| 106 | +if (!function_exists('logo')) { |
|
| 107 | 107 | function logo() |
| 108 | 108 | { |
| 109 | - return getImg(! is_null(setting('logo')) ? setting('logo') : 'adminetic/static/logo.png', 'adminetic/static/logo.png'); |
|
| 109 | + return getImg(!is_null(setting('logo')) ? setting('logo') : 'adminetic/static/logo.png', 'adminetic/static/logo.png'); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | -if (! function_exists('dark_logo')) { |
|
| 113 | +if (!function_exists('dark_logo')) { |
|
| 114 | 114 | function dark_logo() |
| 115 | 115 | { |
| 116 | - return getImg(! is_null(setting('dark_logo')) ? setting('dark_logo') : 'adminetic/static/dark_logo.png', 'adminetic/static/dark_logo.png'); |
|
| 116 | + return getImg(!is_null(setting('dark_logo')) ? setting('dark_logo') : 'adminetic/static/dark_logo.png', 'adminetic/static/dark_logo.png'); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | -if (! function_exists('getLogoBanner')) { |
|
| 120 | +if (!function_exists('getLogoBanner')) { |
|
| 121 | 121 | function getLogoBanner() |
| 122 | 122 | { |
| 123 | - return getImg(! is_null(setting('logo_banner')) ? setting('logo_banner') : 'adminetic/static/logo_banner.png', 'adminetic/static/logo_banner.png'); |
|
| 123 | + return getImg(!is_null(setting('logo_banner')) ? setting('logo_banner') : 'adminetic/static/logo_banner.png', 'adminetic/static/logo_banner.png'); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -if (! function_exists('login_register_bg_image')) { |
|
| 127 | +if (!function_exists('login_register_bg_image')) { |
|
| 128 | 128 | function login_register_bg_image() |
| 129 | 129 | { |
| 130 | - return getImg(! is_null(setting('login_register_bg_image')) ? setting('login_register_bg_image') : 'adminetic/static/login_register_bg_img.jpg', 'adminetic/static/login_register_bg_img.jpg'); |
|
| 130 | + return getImg(!is_null(setting('login_register_bg_image')) ? setting('login_register_bg_image') : 'adminetic/static/login_register_bg_img.jpg', 'adminetic/static/login_register_bg_img.jpg'); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -if (! function_exists('getLazyLoadImg')) { |
|
| 134 | +if (!function_exists('getLazyLoadImg')) { |
|
| 135 | 135 | function getLazyLoadImg() |
| 136 | 136 | { |
| 137 | 137 | return asset('adminetic/static/loader.svg'); |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -if (! function_exists('random_color_part')) { |
|
| 141 | +if (!function_exists('random_color_part')) { |
|
| 142 | 142 | function random_color_part() |
| 143 | 143 | { |
| 144 | 144 | return str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT); |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -if (! function_exists('random_color')) { |
|
| 148 | +if (!function_exists('random_color')) { |
|
| 149 | 149 | function random_color() |
| 150 | 150 | { |
| 151 | 151 | return random_color_part().random_color_part().random_color_part(); |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if (! function_exists('setting')) { |
|
| 155 | +if (!function_exists('setting')) { |
|
| 156 | 156 | function setting($setting_name, $default = null) |
| 157 | 157 | { |
| 158 | 158 | $valid_setting_name = strtolower(str_replace(' ', '_', $setting_name)); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -if (! function_exists('preference')) { |
|
| 165 | +if (!function_exists('preference')) { |
|
| 166 | 166 | function preference($preference_name, bool $default = null) |
| 167 | 167 | { |
| 168 | 168 | $valid_preference_name = strtolower(str_replace(' ', '_', $preference_name)); |
@@ -176,39 +176,39 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | -if (! function_exists('deleteImage')) { |
|
| 179 | +if (!function_exists('deleteImage')) { |
|
| 180 | 180 | function deleteImage($image) |
| 181 | 181 | { |
| 182 | 182 | $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/'.$image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/'.$image)) : '') : ''; |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | -if (! function_exists('api_paginate_limit')) { |
|
| 186 | +if (!function_exists('api_paginate_limit')) { |
|
| 187 | 187 | function api_paginate_limit($default = null) |
| 188 | 188 | { |
| 189 | 189 | return setting('api_paginate_limit', $default ?? config('adminetic.api_paginate_limit', 10)); |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | -if (! function_exists('api_collection_return_paginate')) { |
|
| 193 | +if (!function_exists('api_collection_return_paginate')) { |
|
| 194 | 194 | function api_collection_return_paginate() |
| 195 | 195 | { |
| 196 | 196 | return setting('api_collection_return_paginate', config('adminetic.api_collection_return_paginate', true)); |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -if (! function_exists('darkMode')) { |
|
| 200 | +if (!function_exists('darkMode')) { |
|
| 201 | 201 | function darkMode() |
| 202 | 202 | { |
| 203 | 203 | return setting('dark_mode', config('adminetic.dark_mode', false)); |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | -if (! function_exists('getCondition')) { |
|
| 207 | +if (!function_exists('getCondition')) { |
|
| 208 | 208 | function getCondition($conditions) |
| 209 | 209 | { |
| 210 | 210 | $result = null; |
| 211 | - if (! isset($conditions)) { |
|
| 211 | + if (!isset($conditions)) { |
|
| 212 | 212 | return false; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -if (! function_exists('getImg')) { |
|
| 237 | +if (!function_exists('getImg')) { |
|
| 238 | 238 | function getImg($img, $default) |
| 239 | 239 | { |
| 240 | 240 | if (isset($img)) { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | -if (! function_exists('putContentToClassFunction')) { |
|
| 254 | +if (!function_exists('putContentToClassFunction')) { |
|
| 255 | 255 | function putContentToClassFunction($file, $function_name, $data, $closing_token = '}') |
| 256 | 256 | { |
| 257 | 257 | $data = $data."\n"; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | -if (! function_exists('setEnvValue')) { |
|
| 289 | +if (!function_exists('setEnvValue')) { |
|
| 290 | 290 | function setEnvValue(array $values) |
| 291 | 291 | { |
| 292 | 292 | $envFile = app()->environmentFilePath(); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition); |
| 301 | 301 | |
| 302 | 302 | // If key does not exist, add it |
| 303 | - if (! $keyPosition || ! $endOfLinePosition || ! $oldLine) { |
|
| 303 | + if (!$keyPosition || !$endOfLinePosition || !$oldLine) { |
|
| 304 | 304 | $str .= "{$envKey}={$envValue}\n"; |
| 305 | 305 | } else { |
| 306 | 306 | $str = str_replace($oldLine, "{$envKey}={$envValue}", $str); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $str = substr($str, 0, -1); |
| 312 | - if (! file_put_contents($envFile, $str)) { |
|
| 312 | + if (!file_put_contents($envFile, $str)) { |
|
| 313 | 313 | return false; |
| 314 | 314 | } |
| 315 | 315 | |