Replace env() usage within app (#735)
env() will always return the default value when used outside of config files if the config has been cached
This commit is contained in:
@@ -179,7 +179,7 @@ class Form extends Model implements CachableAttributes
|
||||
public function getViewsCountAttribute()
|
||||
{
|
||||
return $this->remember('views_count', 15 * 60, function (): int {
|
||||
if (env('DB_CONNECTION') == 'mysql') {
|
||||
if (config('database.default') === 'mysql') {
|
||||
return (int) ($this->views()->count() +
|
||||
$this->statistics()->sum(DB::raw("json_extract(data, '$.views')")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user