@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $this->model = $model; |
43 | 43 | $activities = Activity::all(); |
44 | - $this->descriptions = ! is_null($activities) ? array_unique($activities->pluck('description')->toArray()) : null; |
|
44 | + $this->descriptions = !is_null($activities) ? array_unique($activities->pluck('description')->toArray()) : null; |
|
45 | 45 | $this->log_names = array_unique($activities->pluck('log_name')->toArray()); |
46 | 46 | $this->models = array_unique($activities->pluck('subject_type')->toArray()); |
47 | 47 | $this->users = User::find($activities->pluck('causer_id')->toArray()); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function deleteWithLimit() |
57 | 57 | { |
58 | - if (! is_null($this->delete_limit)) { |
|
58 | + if (!is_null($this->delete_limit)) { |
|
59 | 59 | Activity::whereDate('created_at', '<', Carbon::now()->subDays($this->delete_limit))->delete(); |
60 | 60 | $this->emit('activity_success', 'All activities Deleted except last '.$this->delete_limit.'days activities'); |
61 | 61 | } |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | { |
104 | 104 | $data = Activity::query(); |
105 | 105 | // Filter By Log Name |
106 | - if (! is_null($this->log_name)) { |
|
106 | + if (!is_null($this->log_name)) { |
|
107 | 107 | $data = $data->where('log_name', $this->log_name); |
108 | 108 | } |
109 | 109 | // Filter By Model |
110 | - if (! is_null($this->model)) { |
|
110 | + if (!is_null($this->model)) { |
|
111 | 111 | $data = $data->where('subject_type', $this->model); |
112 | 112 | } |
113 | 113 | // Filter By User |
114 | - if (! is_null($this->user_id)) { |
|
114 | + if (!is_null($this->user_id)) { |
|
115 | 115 | $data = $data->where('causer_id', $this->user_id); |
116 | 116 | } |
117 | 117 | // Filter By Date |
118 | - if (! is_null($this->start_date) && ! is_null($this->end_date)) { |
|
118 | + if (!is_null($this->start_date) && !is_null($this->end_date)) { |
|
119 | 119 | $data = $data->whereDate('created_at', [$this->start_date, $this->end_date]); |
120 | 120 | } |
121 | 121 | // Filter Description |
122 | - if (! is_null($this->description)) { |
|
122 | + if (!is_null($this->description)) { |
|
123 | 123 | $data = $data->where('description', $this->description); |
124 | 124 | } |
125 | 125 | $this->activity_count = with($data)->count(); |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | { |
19 | 19 | parent::boot(); |
20 | 20 | |
21 | - static::saving(function () { |
|
21 | + static::saving(function() { |
|
22 | 22 | self::cacheKey(); |
23 | 23 | }); |
24 | 24 | |
25 | - static::deleting(function () { |
|
25 | + static::deleting(function() { |
|
26 | 26 | self::cacheKey(); |
27 | 27 | }); |
28 | 28 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | // Cache Keys |
31 | 31 | private static function cacheKey() |
32 | 32 | { |
33 | - Cache::has('settings') ? Cache::forget('settings') : |
|
34 | - Cache::rememberForever('settings', function () { |
|
33 | + Cache::has('settings') ? Cache::forget('settings') : Cache::rememberForever('settings', function() { |
|
35 | 34 | return Setting::all(); |
36 | 35 | }); |
37 | 36 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $profile = $p ?? Auth::user()->profile ?? Auth::user()->profile()->create(); |
76 | 76 | |
77 | - return isset($profile->profile_pic) ? (Illuminate\Support\Str::contains($profile->profile_pic, ['https://', 'http://']) ? $profile->profile_pic : asset('storage/' . $profile->profile_pic)) : asset(config('adminetic.profile_placeholder', 'adminetic/static/profile.gif')); |
|
77 | + return isset($profile->profile_pic) ? (Illuminate\Support\Str::contains($profile->profile_pic, ['https://', 'http://']) ? $profile->profile_pic : asset('storage/'.$profile->profile_pic)) : asset(config('adminetic.profile_placeholder', 'adminetic/static/profile.gif')); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (!function_exists('random_color')) { |
159 | 159 | function random_color() |
160 | 160 | { |
161 | - return random_color_part() . random_color_part() . random_color_part(); |
|
161 | + return random_color_part().random_color_part().random_color_part(); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | $valid_setting_name = strtolower(str_replace(' ', '_', $setting_name)); |
169 | 169 | $settings = Cache::has('settings') ? |
170 | 170 | Cache::get('settings') |
171 | - : Cache::rememberForever('settings', function () { |
|
171 | + : Cache::rememberForever('settings', function() { |
|
172 | 172 | return Setting::all(); |
173 | 173 | }); |
174 | - $setting = $settings->first(function ($s) use ($valid_setting_name) { |
|
174 | + $setting = $settings->first(function($s) use ($valid_setting_name) { |
|
175 | 175 | return $s->getRawOriginal('setting_name') == $valid_setting_name; |
176 | 176 | }); |
177 | 177 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if (!function_exists('deleteImage')) { |
198 | 198 | function deleteImage($image) |
199 | 199 | { |
200 | - $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/' . $image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/' . $image)) : '') : ''; |
|
200 | + $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/'.$image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/'.$image)) : '') : ''; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | function getImg($img, $default) |
257 | 257 | { |
258 | 258 | if (isset($img)) { |
259 | - if (file_exists(public_path('storage/' . $img))) { |
|
260 | - return asset('storage/' . $img); |
|
259 | + if (file_exists(public_path('storage/'.$img))) { |
|
260 | + return asset('storage/'.$img); |
|
261 | 261 | } elseif (file_exists(public_path($img))) { |
262 | 262 | return asset($img); |
263 | 263 | } else { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | if (!function_exists('putContentToClassFunction')) { |
273 | 273 | function putContentToClassFunction($file, $function_name, $data, $closing_token = '}') |
274 | 274 | { |
275 | - $data = $data . "\n"; |
|
275 | + $data = $data."\n"; |
|
276 | 276 | // Read the contents of the file into a string |
277 | 277 | $contents = file_get_contents($file); |
278 | 278 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $function_definition = substr($contents, $start_pos, $end_pos - $start_pos + 1); |
293 | 293 | |
294 | 294 | // Append the new content to the function definition |
295 | - $modified_function_definition = rtrim($function_definition, $closing_token) . $data . $closing_token; |
|
295 | + $modified_function_definition = rtrim($function_definition, $closing_token).$data.$closing_token; |
|
296 | 296 | |
297 | 297 | // Replace the original function definition with the modified one in the class definition |
298 | 298 | $modified_contents = substr_replace($contents, $modified_function_definition, $start_pos, $end_pos - $start_pos + 1); |