diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index aa8c8f406d..37b0cbc99c 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -141,8 +141,8 @@ class StoreRecurringInvoiceRequest extends Request if (isset($input['auto_bill'])) { $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); } else { - /** @var \App\Models\Client $client */ - if (array_key_exists('client_id', $input) && $client = Client::find($input['client_id'])) { + if (array_key_exists('client_id', $input) && $client = Client::query()->find($input['client_id'])) { + /** @var \App\Models\Client $client */ $input['auto_bill'] = $client->getSetting('auto_bill'); $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); } diff --git a/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php b/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php index 8bd700fefe..99e726254e 100644 --- a/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php +++ b/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php @@ -19,13 +19,14 @@ use Illuminate\Contracts\Validation\Rule; */ class CanStoreClientsRule implements Rule { - public $company_id; - public \App\Models\Company $company; + /** + * @var \App\Models\Company $company + */ + public Company $company; - public function __construct($company_id) + public function __construct(public int $company_id) { - $this->company_id = $company_id; } /** @@ -35,7 +36,7 @@ class CanStoreClientsRule implements Rule */ public function passes($attribute, $value) { - $this->company = Company::find($this->company_id); + $this->company = Company::query()->find($this->company_id); return $this->company->clients()->count() < $this->company->account->hosted_client_count; } diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index 7b0c9abe22..278c5f5838 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -84,7 +84,7 @@ class MatchBankTransactions implements ShouldQueue { MultiDB::setDb($this->db); - $this->company = Company::find($this->company_id); + $this->company = Company::query()->find($this->company_id); if ($this->company->account->bank_integration_account_id) { $yodlee = new Yodlee($this->company->account->bank_integration_account_id);