diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php
index 7d931c1022fa..22c6e4487b6d 100644
--- a/app/Console/Commands/CheckData.php
+++ b/app/Console/Commands/CheckData.php
@@ -564,7 +564,7 @@ class CheckData extends Command
GROUP BY clients.id
HAVING payments_applied != client_paid_to_date
ORDER BY clients.id;
- "));
+ ")->getValue(DB::connection()->getQueryGrammar()));
return $results;
}
@@ -583,7 +583,7 @@ class CheckData extends Command
AND paymentables.amount > 0
AND payments.is_deleted = 0
AND payments.client_id = ?;
- "), [App\Models\Credit::class, $client->id]);
+ ")->getValue(DB::connection()->getQueryGrammar()), [App\Models\Credit::class, $client->id]);
return $results;
}
@@ -636,7 +636,7 @@ class CheckData extends Command
->where('clients.updated_at', '>', now()->subDays(2))
->groupBy('clients.id')
->havingRaw('clients.paid_to_date != sum(coalesce(payments.amount - payments.refunded, 0))')
- ->get(['clients.id', 'clients.paid_to_date', DB::raw('sum(coalesce(payments.amount - payments.refunded, 0)) as amount')]);
+ ->get(['clients.id', 'clients.paid_to_date', DB::raw('sum(coalesce(payments.amount - payments.refunded, 0)) as amount')->getValue(DB::connection()->getQueryGrammar())]);
/* Due to accounting differences we need to perform a second loop here to ensure there actually is an issue */
$clients->each(function ($client_record) use ($credit_total_applied) {
@@ -656,7 +656,7 @@ class CheckData extends Command
$p = Payment::where('client_id', $client->id)
->where('is_deleted', 0)
->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED])
- ->sum(DB::Raw('amount - applied'));
+ ->sum(DB::Raw('amount - applied')->getValue(DB::connection()->getQueryGrammar()));
$total_invoice_payments += $p;
@@ -736,7 +736,7 @@ class CheckData extends Command
GROUP BY clients.id
HAVING invoice_balance != clients.balance
ORDER BY clients.id;
- "));
+ ")->getValue(DB::connection()->getQueryGrammar()));
return $results;
}
@@ -827,7 +827,7 @@ class CheckData extends Command
GROUP BY clients.id
HAVING(invoices_balance != clients.balance)
ORDER BY clients.id;
- "));
+ ")->getValue(DB::connection()->getQueryGrammar()));
return $results;
}
@@ -961,7 +961,7 @@ class CheckData extends Command
}
$records = DB::table($table)
->join($tableName, "{$tableName}.id", '=', "{$table}.{$field}_id")
- ->where("{$table}.{$company_id}", '!=', DB::raw("{$tableName}.company_id"))
+ ->where("{$table}.{$company_id}", '!=', DB::raw("{$tableName}.company_id")->getValue(DB::connection()->getQueryGrammar()))
->get(["{$table}.id"]);
if ($records->count()) {
diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php
index 04ace061da52..fb196121b1f2 100644
--- a/app/Import/Providers/BaseImport.php
+++ b/app/Import/Providers/BaseImport.php
@@ -734,7 +734,7 @@ class BaseImport
{
$user = User::where('account_id', $this->company->account->id)
->where(
- \DB::raw('CONCAT_WS(" ", first_name, last_name)'),
+ \DB::raw('CONCAT_WS(" ", first_name, last_name)')->getValue(DB::connection()->getQueryGrammar()),
'like',
'%'.$user_hash.'%'
)
diff --git a/app/Jobs/Ninja/CheckCompanyData.php b/app/Jobs/Ninja/CheckCompanyData.php
index bd4d95504e96..3c9818beffec 100644
--- a/app/Jobs/Ninja/CheckCompanyData.php
+++ b/app/Jobs/Ninja/CheckCompanyData.php
@@ -158,17 +158,6 @@ class CheckCompanyData implements ShouldQueue
$total_invoice_payments += ($total_amount - $total_refund);
}
- //10/02/21
- // foreach ($client->payments as $payment) {
- // $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(DB::raw('amount'));
- // }
-
- // if ($credit_total_applied < 0) {
- // $total_invoice_payments += $credit_total_applied;
- // } //todo this is contentious
-
- // nlog("total invoice payments = {$total_invoice_payments} with client paid to date of of {$client->paid_to_date}");
-
if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) {
$wrong_paid_to_dates++;
@@ -287,7 +276,7 @@ class CheckCompanyData implements ShouldQueue
// $clients->where('clients.id', '=', $this->option('client_id'));
// }
- $clients = $clients->get(['clients.id', DB::raw('count(client_contacts.id)')]);
+ $clients = $clients->get(['clients.id', DB::raw('count(client_contacts.id)')->getValue(DB::connection()->getQueryGrammar())]);
$this->company_data[] = $clients->count().' clients without a single primary contact';
if ($clients->count() > 0) {
@@ -326,7 +315,7 @@ class CheckCompanyData implements ShouldQueue
}
$records = DB::table($table)
->join($tableName, "{$tableName}.id", '=', "{$table}.{$field}_id")
- ->where("{$table}.{$company_id}", '!=', DB::raw("{$tableName}.company_id"))
+ ->where("{$table}.{$company_id}", '!=', DB::raw("{$tableName}.company_id")->getValue(DB::connection()->getQueryGrammar()))
->get(["{$table}.id"]);
if ($records->count()) {
diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php
index 8a12e02e11d4..143ef43a2cdf 100644
--- a/app/Jobs/Util/Import.php
+++ b/app/Jobs/Util/Import.php
@@ -302,7 +302,7 @@ class Import implements ShouldQueue
// 10/02/21
foreach ($client->payments as $payment) {
- $credit_total_applied += $payment->paymentables()->where('paymentable_type', \App\Models\Credit::class)->get()->sum(\DB::raw('amount'));
+ $credit_total_applied += $payment->paymentables()->where('paymentable_type', \App\Models\Credit::class)->get()->sum(\DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
}
if ($credit_total_applied < 0) {
diff --git a/app/Services/Chart/ChartQueries.php b/app/Services/Chart/ChartQueries.php
index e4b881c93688..6aee8c1a4230 100644
--- a/app/Services/Chart/ChartQueries.php
+++ b/app/Services/Chart/ChartQueries.php
@@ -34,7 +34,7 @@ trait ChartQueries
AND (expenses.date BETWEEN :start_date AND :end_date)
{$user_filter}
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getExpenseChartQuery($start_date, $end_date, $currency_id)
@@ -54,7 +54,7 @@ trait ChartQueries
{$user_filter}
GROUP BY expenses.date
HAVING currency_id = :currency_id
- "), [
+ ")->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
@@ -80,7 +80,7 @@ trait ChartQueries
AND payments.company_id = :company_id
AND (payments.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), [
+ ")->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => $this->company->settings->currency_id,
'company_id' => $this->company->id,
'start_date' => $start_date,
@@ -106,7 +106,7 @@ trait ChartQueries
AND (payments.date BETWEEN :start_date AND :end_date)
GROUP BY payments.date
HAVING currency_id = :currency_id
- "), [
+ ")->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
@@ -139,7 +139,7 @@ trait ChartQueries
AND invoices.balance > 0
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getRevenueQueryX($start_date, $end_date)
@@ -161,7 +161,7 @@ trait ChartQueries
AND invoices.status_id IN (3,4)
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getRevenueQuery($start_date, $end_date)
@@ -179,7 +179,7 @@ trait ChartQueries
AND payments.status_id IN (1,4,5,6)
AND (payments.date BETWEEN :start_date AND :end_date)
GROUP BY payments.currency_id
- "), ['company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getInvoicesQuery($start_date, $end_date)
@@ -201,7 +201,7 @@ trait ChartQueries
AND invoices.is_deleted = 0
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getOutstandingChartQuery($start_date, $end_date, $currency_id)
@@ -224,7 +224,7 @@ trait ChartQueries
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY invoices.date
HAVING currency_id = :currency_id
- "), [
+ ")->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => (int) $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
@@ -254,7 +254,7 @@ trait ChartQueries
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY invoices.date
HAVING currency_id = :currency_id
- "), [
+ ")->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => (int) $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
diff --git a/app/Services/Chart/ChartQueriesLegacy.php b/app/Services/Chart/ChartQueriesLegacy.php
index 2e03bca4abee..f79bc06d938f 100644
--- a/app/Services/Chart/ChartQueriesLegacy.php
+++ b/app/Services/Chart/ChartQueriesLegacy.php
@@ -23,6 +23,7 @@ trait ChartQueriesLegacy
*/
public function getExpenseQuery($start_date, $end_date)
{
+
return DB::select(DB::raw('
SELECT sum(expenses.amount) as amount,
IFNULL(expenses.currency_id, :company_currency) as currency_id
@@ -31,7 +32,7 @@ trait ChartQueriesLegacy
AND expenses.company_id = :company_id
AND (expenses.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- '), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ')->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getExpenseChartQuery($start_date, $end_date, $currency_id)
@@ -47,7 +48,7 @@ trait ChartQueriesLegacy
AND expenses.is_deleted = 0
GROUP BY expenses.date
HAVING currency_id = :currency_id
- '), [
+ ')->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
@@ -69,7 +70,7 @@ trait ChartQueriesLegacy
AND payments.company_id = :company_id
AND (payments.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- '), [
+ ')->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => $this->company->settings->currency_id,
'company_id' => $this->company->id,
'start_date' => $start_date,
@@ -91,7 +92,7 @@ trait ChartQueriesLegacy
AND payments.is_deleted = 0
GROUP BY payments.date
HAVING currency_id = :currency_id
- '), [
+ ')->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
@@ -119,7 +120,7 @@ trait ChartQueriesLegacy
AND invoices.is_deleted = 0
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
}
public function getRevenueQuery($start_date, $end_date)
@@ -158,7 +159,7 @@ trait ChartQueriesLegacy
AND invoices.is_deleted = 0
GROUP BY invoices.date
HAVING currency_id = :currency_id
- "), [
+ ")->getValue(DB::connection()->getQueryGrammar()), [
'company_currency' => (int) $this->company->settings->currency_id,
'currency_id' => $currency_id,
'company_id' => $this->company->id,
diff --git a/app/Services/Invoice/HandleRestore.php b/app/Services/Invoice/HandleRestore.php
index de3a990baad2..b63afa76ed56 100644
--- a/app/Services/Invoice/HandleRestore.php
+++ b/app/Services/Invoice/HandleRestore.php
@@ -96,17 +96,17 @@ class HandleRestore extends AbstractService
$this->adjustment_amount += $payment->paymentables
->where('paymentable_type', '=', 'invoices')
->where('paymentable_id', $this->invoice->id)
- ->sum(DB::raw('amount'));
+ ->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
$this->adjustment_amount += $payment->paymentables
->where('paymentable_type', '=', 'invoices')
->where('paymentable_id', $this->invoice->id)
- ->sum(DB::raw('refunded'));
+ ->sum(DB::raw('refunded')->getValue(DB::connection()->getQueryGrammar()));
//14/07/2023 - do not include credits in the payment amount
$this->adjustment_amount -= $payment->paymentables
->where('paymentable_type', '=', 'App\Models\Credit')
- ->sum(DB::raw('amount'));
+ ->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
}
diff --git a/app/Services/Invoice/MarkInvoiceDeleted.php b/app/Services/Invoice/MarkInvoiceDeleted.php
index 72cfe0136de3..87b9d01288ca 100644
--- a/app/Services/Invoice/MarkInvoiceDeleted.php
+++ b/app/Services/Invoice/MarkInvoiceDeleted.php
@@ -88,17 +88,17 @@ class MarkInvoiceDeleted extends AbstractService
$payment_adjustment = $payment->paymentables
->where('paymentable_type', '=', 'invoices')
->where('paymentable_id', $this->invoice->id)
- ->sum(DB::raw('amount'));
+ ->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
$payment_adjustment -= $payment->paymentables
->where('paymentable_type', '=', 'invoices')
->where('paymentable_id', $this->invoice->id)
- ->sum(DB::raw('refunded'));
+ ->sum(DB::raw('refunded')->getValue(DB::connection()->getQueryGrammar()));
//14-07-2023 - Do not include credits in the payment adjustment.
$payment_adjustment -= $payment->paymentables
->where('paymentable_type', '=', 'App\Models\Credit')
- ->sum(DB::raw('amount'));
+ ->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
$payment->amount -= $payment_adjustment;
$payment->applied -= $payment_adjustment;
diff --git a/app/Services/Report/ProfitLoss.php b/app/Services/Report/ProfitLoss.php
index 12b19f6488f7..07eccd1542b9 100644
--- a/app/Services/Report/ProfitLoss.php
+++ b/app/Services/Report/ProfitLoss.php
@@ -250,7 +250,7 @@ class ProfitLoss
AND invoices.is_deleted = 0
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
}
/**
@@ -421,7 +421,7 @@ class ProfitLoss
AND invoices.is_deleted = 0
AND (invoices.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
+ ")->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
}
/**
@@ -447,7 +447,7 @@ class ProfitLoss
AND (payments.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
ORDER BY currency_id;
- '), ['company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
+ ')->getValue(DB::connection()->getQueryGrammar()), ['company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
}
private function expenseData()
@@ -553,7 +553,7 @@ class ProfitLoss
AND expenses.company_id = :company_id
AND (expenses.date BETWEEN :start_date AND :end_date)
GROUP BY currency_id
- '), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
+ ')->getValue(DB::connection()->getQueryGrammar()), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
}
private function setBillingReportType()
diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php
index 3581ba530ada..7f5e914a3be6 100644
--- a/app/Transformers/AccountTransformer.php
+++ b/app/Transformers/AccountTransformer.php
@@ -28,7 +28,7 @@ class AccountTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
//'default_company',
//'user',
//'company_users'
@@ -37,7 +37,7 @@ class AccountTransformer extends EntityTransformer
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'default_company',
'company_users',
'companies',
diff --git a/app/Transformers/ActivityTransformer.php b/app/Transformers/ActivityTransformer.php
index 77c3cebe6ae3..9c910daae682 100644
--- a/app/Transformers/ActivityTransformer.php
+++ b/app/Transformers/ActivityTransformer.php
@@ -34,12 +34,12 @@ class ActivityTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [];
+ protected array $defaultIncludes = [];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'history',
'user',
'client',
diff --git a/app/Transformers/ArraySerializer.php b/app/Transformers/ArraySerializer.php
index 7ba37a86d055..33669fc17098 100644
--- a/app/Transformers/ArraySerializer.php
+++ b/app/Transformers/ArraySerializer.php
@@ -24,7 +24,7 @@ class ArraySerializer extends FractalArraySerializer
*
* @return array
*/
- public function collection($resourceKey, array $data)
+ public function collection(?string $resourceKey, array $data): array
{
return $data;
}
@@ -35,7 +35,7 @@ class ArraySerializer extends FractalArraySerializer
*
* @return array
*/
- public function item($resourceKey, array $data)
+ public function item(?string $resourceKey, array $data): array
{
return $data;
}
diff --git a/app/Transformers/BankIntegrationTransformer.php b/app/Transformers/BankIntegrationTransformer.php
index c0a983ced78d..c414e76f466d 100644
--- a/app/Transformers/BankIntegrationTransformer.php
+++ b/app/Transformers/BankIntegrationTransformer.php
@@ -28,7 +28,7 @@ class BankIntegrationTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
//'default_company',
//'user',
//'company_users'
@@ -37,7 +37,7 @@ class BankIntegrationTransformer extends EntityTransformer
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'company',
'account',
'bank_transactions',
diff --git a/app/Transformers/BankTransactionRuleTransformer.php b/app/Transformers/BankTransactionRuleTransformer.php
index 4d410c1b3bd9..9b9b71ed65a4 100644
--- a/app/Transformers/BankTransactionRuleTransformer.php
+++ b/app/Transformers/BankTransactionRuleTransformer.php
@@ -29,13 +29,13 @@ class BankTransactionRuleTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'company',
'vendor',
'client',
diff --git a/app/Transformers/BankTransactionTransformer.php b/app/Transformers/BankTransactionTransformer.php
index 2a1c15f9e642..dd9484c13542 100644
--- a/app/Transformers/BankTransactionTransformer.php
+++ b/app/Transformers/BankTransactionTransformer.php
@@ -28,13 +28,13 @@ class BankTransactionTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'company',
// 'expense',
'payment',
diff --git a/app/Transformers/ClientTransformer.php b/app/Transformers/ClientTransformer.php
index 07b683fa8f34..f34b805ff581 100644
--- a/app/Transformers/ClientTransformer.php
+++ b/app/Transformers/ClientTransformer.php
@@ -29,7 +29,7 @@ class ClientTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'contacts',
'documents',
'gateway_tokens',
@@ -38,7 +38,7 @@ class ClientTransformer extends EntityTransformer
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'activities',
'ledger',
'system_logs',
diff --git a/app/Transformers/CompanyGatewayTransformer.php b/app/Transformers/CompanyGatewayTransformer.php
index 2c79a442a557..9a0fd943d17b 100644
--- a/app/Transformers/CompanyGatewayTransformer.php
+++ b/app/Transformers/CompanyGatewayTransformer.php
@@ -29,13 +29,13 @@ class CompanyGatewayTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'system_logs',
'gateway',
];
diff --git a/app/Transformers/CompanyTokenHashedTransformer.php b/app/Transformers/CompanyTokenHashedTransformer.php
index 254aa2beb07f..d9c1ee132fc4 100644
--- a/app/Transformers/CompanyTokenHashedTransformer.php
+++ b/app/Transformers/CompanyTokenHashedTransformer.php
@@ -24,13 +24,13 @@ class CompanyTokenHashedTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/CompanyTokenTransformer.php b/app/Transformers/CompanyTokenTransformer.php
index 5e83e1149b9a..76083f063ff7 100644
--- a/app/Transformers/CompanyTokenTransformer.php
+++ b/app/Transformers/CompanyTokenTransformer.php
@@ -24,13 +24,13 @@ class CompanyTokenTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php
index ed6529d32a39..c3e9f2564193 100644
--- a/app/Transformers/CompanyTransformer.php
+++ b/app/Transformers/CompanyTransformer.php
@@ -59,14 +59,14 @@ class CompanyTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'documents',
'users',
'designs',
diff --git a/app/Transformers/CompanyUserTransformer.php b/app/Transformers/CompanyUserTransformer.php
index 2115cf88423c..43e76a0f84c0 100644
--- a/app/Transformers/CompanyUserTransformer.php
+++ b/app/Transformers/CompanyUserTransformer.php
@@ -22,14 +22,14 @@ class CompanyUserTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
// 'user',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'user',
'company',
'token',
diff --git a/app/Transformers/Contact/InvoiceTransformer.php b/app/Transformers/Contact/InvoiceTransformer.php
index 2c711acd7a75..af148ad39db6 100644
--- a/app/Transformers/Contact/InvoiceTransformer.php
+++ b/app/Transformers/Contact/InvoiceTransformer.php
@@ -19,11 +19,11 @@ class InvoiceTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
// 'invoice_items',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
public function transform(Invoice $invoice)
diff --git a/app/Transformers/CreditTransformer.php b/app/Transformers/CreditTransformer.php
index 53d4f2fc0ed6..c6e296316043 100644
--- a/app/Transformers/CreditTransformer.php
+++ b/app/Transformers/CreditTransformer.php
@@ -24,12 +24,12 @@ class CreditTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'invitations',
'documents',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'activities',
'client',
];
diff --git a/app/Transformers/DesignTransformer.php b/app/Transformers/DesignTransformer.php
index ccde852575c8..953f5f164881 100644
--- a/app/Transformers/DesignTransformer.php
+++ b/app/Transformers/DesignTransformer.php
@@ -26,13 +26,13 @@ class DesignTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/DocumentTransformer.php b/app/Transformers/DocumentTransformer.php
index 1b167ae21691..c916efe9d440 100644
--- a/app/Transformers/DocumentTransformer.php
+++ b/app/Transformers/DocumentTransformer.php
@@ -20,9 +20,9 @@ class DocumentTransformer extends EntityTransformer
protected $serializer;
- protected $defaultIncludes = [];
+ protected array $defaultIncludes = [];
- protected $availableIncludes = [];
+ protected array $availableIncludes = [];
public function __construct($serializer = null)
{
diff --git a/app/Transformers/EntityTransformer.php b/app/Transformers/EntityTransformer.php
index 37181078c6d4..acc4177be080 100644
--- a/app/Transformers/EntityTransformer.php
+++ b/app/Transformers/EntityTransformer.php
@@ -44,7 +44,7 @@ class EntityTransformer extends TransformerAbstract
return $this->item($data, $transformer, $entityType);
}
- public function getDefaultIncludes()
+ public function getDefaultIncludes(): array
{
return $this->defaultIncludes;
}
diff --git a/app/Transformers/ExpenseCategoryTransformer.php b/app/Transformers/ExpenseCategoryTransformer.php
index 4013b7e8f0ec..08b4628edd17 100644
--- a/app/Transformers/ExpenseCategoryTransformer.php
+++ b/app/Transformers/ExpenseCategoryTransformer.php
@@ -23,13 +23,13 @@ class ExpenseCategoryTransformer extends EntityTransformer
use MakesHash;
use SoftDeletes;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/ExpenseTransformer.php b/app/Transformers/ExpenseTransformer.php
index 653d0ee155ff..760f35909c52 100644
--- a/app/Transformers/ExpenseTransformer.php
+++ b/app/Transformers/ExpenseTransformer.php
@@ -30,14 +30,14 @@ class ExpenseTransformer extends EntityTransformer
use MakesHash;
use SoftDeletes;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'client',
'vendor',
'category',
diff --git a/app/Transformers/GatewayTransformer.php b/app/Transformers/GatewayTransformer.php
index 0bad79f250f6..4c71170c2bb0 100644
--- a/app/Transformers/GatewayTransformer.php
+++ b/app/Transformers/GatewayTransformer.php
@@ -21,13 +21,13 @@ class GatewayTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/GroupSettingTransformer.php b/app/Transformers/GroupSettingTransformer.php
index 3a7695ccee8a..17e47c80562c 100644
--- a/app/Transformers/GroupSettingTransformer.php
+++ b/app/Transformers/GroupSettingTransformer.php
@@ -23,14 +23,14 @@ class GroupSettingTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/InvoiceHistoryTransformer.php b/app/Transformers/InvoiceHistoryTransformer.php
index 54092d24bb1f..dfefccc5351f 100644
--- a/app/Transformers/InvoiceHistoryTransformer.php
+++ b/app/Transformers/InvoiceHistoryTransformer.php
@@ -19,11 +19,11 @@ class InvoiceHistoryTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
// 'activity',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'activity',
];
diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php
index d30ef214be3f..cc271bebe43b 100644
--- a/app/Transformers/InvoiceTransformer.php
+++ b/app/Transformers/InvoiceTransformer.php
@@ -24,12 +24,12 @@ class InvoiceTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'invitations',
'documents',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'payments',
'client',
'activities',
diff --git a/app/Transformers/PaymentTransformer.php b/app/Transformers/PaymentTransformer.php
index af6bbfbe55e1..2c9df5a4073c 100644
--- a/app/Transformers/PaymentTransformer.php
+++ b/app/Transformers/PaymentTransformer.php
@@ -24,12 +24,12 @@ class PaymentTransformer extends EntityTransformer
protected $serializer;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'paymentables',
'documents',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'client',
'invoices',
];
diff --git a/app/Transformers/PaymentableTransformer.php b/app/Transformers/PaymentableTransformer.php
index fc1c83c2a432..48a884e60816 100644
--- a/app/Transformers/PaymentableTransformer.php
+++ b/app/Transformers/PaymentableTransformer.php
@@ -21,9 +21,9 @@ class PaymentableTransformer extends EntityTransformer
protected $serializer;
- protected $defaultIncludes = [];
+ protected array $defaultIncludes = [];
- protected $availableIncludes = [];
+ protected array $availableIncludes = [];
public function __construct($serializer = null)
{
diff --git a/app/Transformers/ProductTransformer.php b/app/Transformers/ProductTransformer.php
index 7ed02a233736..bab47b6f7940 100644
--- a/app/Transformers/ProductTransformer.php
+++ b/app/Transformers/ProductTransformer.php
@@ -22,14 +22,14 @@ class ProductTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'company',
'user',
];
diff --git a/app/Transformers/ProjectTransformer.php b/app/Transformers/ProjectTransformer.php
index 96c67311f8cb..729552b58e69 100644
--- a/app/Transformers/ProjectTransformer.php
+++ b/app/Transformers/ProjectTransformer.php
@@ -25,14 +25,14 @@ class ProjectTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'client',
'tasks',
];
diff --git a/app/Transformers/PurchaseOrderTransformer.php b/app/Transformers/PurchaseOrderTransformer.php
index 527cca34666f..58b270595eba 100644
--- a/app/Transformers/PurchaseOrderTransformer.php
+++ b/app/Transformers/PurchaseOrderTransformer.php
@@ -22,12 +22,12 @@ class PurchaseOrderTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'invitations',
'documents'
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'expense',
'vendor',
];
diff --git a/app/Transformers/QuoteTransformer.php b/app/Transformers/QuoteTransformer.php
index bdbe0bfa27a2..4d4cf0ced301 100644
--- a/app/Transformers/QuoteTransformer.php
+++ b/app/Transformers/QuoteTransformer.php
@@ -24,12 +24,12 @@ class QuoteTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'invitations',
'documents',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'activities',
'client',
];
diff --git a/app/Transformers/RecurringExpenseTransformer.php b/app/Transformers/RecurringExpenseTransformer.php
index 6d323093387c..62388d1f9a8b 100644
--- a/app/Transformers/RecurringExpenseTransformer.php
+++ b/app/Transformers/RecurringExpenseTransformer.php
@@ -27,14 +27,14 @@ class RecurringExpenseTransformer extends EntityTransformer
use MakesHash;
use SoftDeletes;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'documents',
'client',
'vendor',
diff --git a/app/Transformers/RecurringInvoiceTransformer.php b/app/Transformers/RecurringInvoiceTransformer.php
index b692ff838fdd..38008e52261d 100644
--- a/app/Transformers/RecurringInvoiceTransformer.php
+++ b/app/Transformers/RecurringInvoiceTransformer.php
@@ -23,12 +23,12 @@ class RecurringInvoiceTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'invitations',
'documents',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'activities',
'client',
];
diff --git a/app/Transformers/RecurringQuoteTransformer.php b/app/Transformers/RecurringQuoteTransformer.php
index 905329c2282e..d6375e0953df 100644
--- a/app/Transformers/RecurringQuoteTransformer.php
+++ b/app/Transformers/RecurringQuoteTransformer.php
@@ -22,12 +22,12 @@ class RecurringQuoteTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'invitations',
'documents',
];
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'invitations',
'documents',
'activities',
diff --git a/app/Transformers/Shop/CompanyShopProfileTransformer.php b/app/Transformers/Shop/CompanyShopProfileTransformer.php
index 8d9838bf6255..358ad5e321bd 100644
--- a/app/Transformers/Shop/CompanyShopProfileTransformer.php
+++ b/app/Transformers/Shop/CompanyShopProfileTransformer.php
@@ -26,13 +26,13 @@ class CompanyShopProfileTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
/**
diff --git a/app/Transformers/SubscriptionTransformer.php b/app/Transformers/SubscriptionTransformer.php
index 9cf2076c4ac6..7a9b53535ceb 100644
--- a/app/Transformers/SubscriptionTransformer.php
+++ b/app/Transformers/SubscriptionTransformer.php
@@ -22,13 +22,13 @@ class SubscriptionTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
];
public function transform(Subscription $subscription): array
diff --git a/app/Transformers/SystemLogTransformer.php b/app/Transformers/SystemLogTransformer.php
index 37ccc13a78f6..b287c67c3598 100644
--- a/app/Transformers/SystemLogTransformer.php
+++ b/app/Transformers/SystemLogTransformer.php
@@ -9,12 +9,12 @@ class SystemLogTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [];
+ protected array $defaultIncludes = [];
/**
* @var array
*/
- protected $availableIncludes = [];
+ protected array $availableIncludes = [];
/**
* @param SystemLog $system_log
diff --git a/app/Transformers/TaskTransformer.php b/app/Transformers/TaskTransformer.php
index cd668ba6bf63..b4d50535f5fb 100644
--- a/app/Transformers/TaskTransformer.php
+++ b/app/Transformers/TaskTransformer.php
@@ -28,7 +28,7 @@ class TaskTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'documents',
'project',
];
@@ -36,7 +36,7 @@ class TaskTransformer extends EntityTransformer
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'client',
'status',
'project',
diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php
index ee251477dea1..21321b0946d6 100644
--- a/app/Transformers/UserTransformer.php
+++ b/app/Transformers/UserTransformer.php
@@ -25,14 +25,14 @@ class UserTransformer extends EntityTransformer
/**
* @var array
*/
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
//'company_user'
];
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'companies',
'company_users',
'company_user',
diff --git a/app/Transformers/VendorTransformer.php b/app/Transformers/VendorTransformer.php
index bbf1bfcde77e..051e8fb2f497 100644
--- a/app/Transformers/VendorTransformer.php
+++ b/app/Transformers/VendorTransformer.php
@@ -25,7 +25,7 @@ class VendorTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [
+ protected array $defaultIncludes = [
'contacts',
'documents',
];
@@ -33,7 +33,7 @@ class VendorTransformer extends EntityTransformer
/**
* @var array
*/
- protected $availableIncludes = [
+ protected array $availableIncludes = [
'activities',
];
diff --git a/app/Transformers/WebhookTransformer.php b/app/Transformers/WebhookTransformer.php
index b67686600261..11d265ef7cf5 100644
--- a/app/Transformers/WebhookTransformer.php
+++ b/app/Transformers/WebhookTransformer.php
@@ -9,12 +9,12 @@ class WebhookTransformer extends EntityTransformer
{
use MakesHash;
- protected $defaultIncludes = [];
+ protected array $defaultIncludes = [];
/**
* @var array
*/
- protected $availableIncludes = [];
+ protected array $availableIncludes = [];
/**
* @param Webhook $webhook
diff --git a/app/Utils/Ninja.php b/app/Utils/Ninja.php
index 42e6ee271254..9b41b6ab0e65 100644
--- a/app/Utils/Ninja.php
+++ b/app/Utils/Ninja.php
@@ -43,7 +43,7 @@ class Ninja
public static function getDebugInfo()
{
- $mysql_version = DB::select(DB::raw('select version() as version'))[0]->version;
+ $mysql_version = DB::select(DB::raw('select version() as version')->getValue(DB::connection()->getQueryGrammar()))[0]->version;
$version = request()->input('version', 'No Version Supplied.');
diff --git a/phpunit.xml b/phpunit.xml
index 81d3e64b46f4..70062c3f9d15 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -23,6 +23,7 @@
+
diff --git a/tests/Feature/Export/ReportApiTest.php b/tests/Feature/Export/ReportApiTest.php
index 14fd1f57297b..408177031db8 100644
--- a/tests/Feature/Export/ReportApiTest.php
+++ b/tests/Feature/Export/ReportApiTest.php
@@ -11,10 +11,12 @@
namespace Tests\Feature\Export;
-use App\Utils\Traits\MakesHash;
-use Illuminate\Routing\Middleware\ThrottleRequests;
-use Tests\MockAccountData;
use Tests\TestCase;
+use Tests\MockAccountData;
+use App\Utils\Traits\MakesHash;
+use Illuminate\Support\Facades\Event;
+use Illuminate\Routing\Middleware\ThrottleRequests;
+use Illuminate\Foundation\Testing\Concerns\InteractsWithExceptionHandling;
/**
* @test
@@ -23,7 +25,7 @@ class ReportApiTest extends TestCase
{
use MakesHash;
use MockAccountData;
-
+
public $faker;
protected function setUp() :void
@@ -36,8 +38,7 @@ class ReportApiTest extends TestCase
ThrottleRequests::class
);
- $this->withoutExceptionHandling();
-
+ // $this->withoutExceptionHandling();
$this->makeTestData();
}
diff --git a/tests/Feature/Export/UserSalesReportTest.php b/tests/Feature/Export/UserSalesReportTest.php
index 5003d5ad5f55..bff92d6a34bb 100644
--- a/tests/Feature/Export/UserSalesReportTest.php
+++ b/tests/Feature/Export/UserSalesReportTest.php
@@ -11,18 +11,21 @@
namespace Tests\Feature\Export;
-use App\DataMapper\CompanySettings;
-use App\Export\CSV\ProductSalesExport;
-use App\Factory\InvoiceItemFactory;
-use App\Models\Account;
+use Tests\TestCase;
+use App\Models\User;
use App\Models\Client;
+use App\Models\Account;
use App\Models\Company;
use App\Models\Invoice;
-use App\Models\User;
-use App\Services\Report\UserSalesReport;
+use App\Utils\Traits\AppSetup;
use App\Utils\Traits\MakesHash;
+use App\DataMapper\CompanySettings;
+use App\Factory\InvoiceItemFactory;
+use Illuminate\Support\Facades\Cache;
+use App\Export\CSV\ProductSalesExport;
+use Illuminate\Support\Facades\Schema;
+use App\Services\Report\UserSalesReport;
use Illuminate\Routing\Middleware\ThrottleRequests;
-use Tests\TestCase;
/**
* @test
@@ -44,6 +47,32 @@ class UserSalesReportTest extends TestCase
);
$this->withoutExceptionHandling();
+
+ /* Warm up the cache !*/
+ $cached_tables = config('ninja.cached_tables');
+
+ $this->artisan('db:seed --force');
+
+ foreach ($cached_tables as $name => $class) {
+ // check that the table exists in case the migration is pending
+ if (! Schema::hasTable((new $class())->getTable())) {
+ continue;
+ }
+ if ($name == 'payment_terms') {
+ $orderBy = 'num_days';
+ } elseif ($name == 'fonts') {
+ $orderBy = 'sort_order';
+ } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) {
+ $orderBy = 'name';
+ } else {
+ $orderBy = 'id';
+ }
+ $tableData = $class::orderBy($orderBy)->get();
+ if ($tableData->count()) {
+ Cache::forever($name, $tableData);
+ }
+ }
+
}
public $company;
diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php
index d270d172edba..f00d619ee2a9 100644
--- a/tests/MockAccountData.php
+++ b/tests/MockAccountData.php
@@ -57,7 +57,6 @@ use App\Models\VendorContact;
use App\Utils\Traits\GeneratesCounter;
use App\Utils\Traits\MakesHash;
use App\Utils\TruthSource;
-use Illuminate\Foundation\Testing\WithoutEvents;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash;
@@ -71,7 +70,6 @@ trait MockAccountData
{
use MakesHash;
use GeneratesCounter;
- use WithoutEvents;
/**
* @var
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 2932d4a69d65..df4697ddbf7c 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -2,6 +2,7 @@
namespace Tests;
+use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
diff --git a/tests/Unit/WithTypeHelpersTest.php b/tests/Unit/WithTypeHelpersTest.php
index 73bc0425bebc..d5ec9faeecc2 100644
--- a/tests/Unit/WithTypeHelpersTest.php
+++ b/tests/Unit/WithTypeHelpersTest.php
@@ -15,10 +15,13 @@ namespace Tests\Unit;
use App\Models\Account;
use App\Models\Company;
use App\Models\Document;
+use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;
class WithTypeHelpersTest extends TestCase
{
+ use DatabaseMigrations;
+
public function testIsImageHelper(): void
{
$account = Account::factory()->create();