Skip to content

Beautiful Open-Source Form Builder

Replace env() usage within app (#735)

Mike Gilfillan2558ee965c76
diff --git a/api/app/Models/Forms/Form.php b/api/app/Models/Forms/Form.php
index 49e4e0491..5f49caa21 100644
--- a/api/app/Models/Forms/Form.php
+++ b/api/app/Models/Forms/Form.php
@@ -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')")));
}
diff --git a/api/app/Service/Forms/FormLogicConditionChecker.php b/api/app/Service/Forms/FormLogicConditionChecker.php
index 707b1ffc1..db77742c8 100644
--- a/api/app/Service/Forms/FormLogicConditionChecker.php
+++ b/api/app/Service/Forms/FormLogicConditionChecker.php
@@ -321,7 +321,7 @@ class FormLogicConditionChecker
->where(function ($query) use ($condition, $fieldValue) {
$fieldId = $condition['property_meta']['id'];
- if (env('DB_CONNECTION') == 'mysql') {
+ if (config('database.default') === 'mysql') {
// For scalar values
$query->where(function ($q) use ($fieldId, $fieldValue) {
$q->whereRaw("JSON_UNQUOTE(JSON_EXTRACT(data, '$.\"$fieldId\"')) = ?", [$fieldValue]);