Mysql Support (#60)

This commit is contained in:
Chirag 2023-01-05 19:46:16 +05:30 committed by GitHub
parent 5486768125
commit f5ff94b508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -141,9 +141,10 @@ class Form extends Model
return $this->views()->count() + return $this->views()->count() +
$this->statistics()->sum(DB::raw("cast(data->>'views' as integer)")); $this->statistics()->sum(DB::raw("cast(data->>'views' as integer)"));
} elseif(env('DB_CONNECTION') == 'mysql') { } elseif(env('DB_CONNECTION') == 'mysql') {
return $this->views()->count() + return (int)($this->views()->count() +
$this->statistics()->sum(DB::raw("json_extract(data, '$.views')")); // code to $this->statistics()->sum(DB::raw("json_extract(data, '$.views')")));
} }
return 0;
} }
public function setDescriptionAttribute($value) public function setDescriptionAttribute($value)