Updated static analysis

This commit is contained in:
David Bomba 2023-08-07 15:37:30 +10:00
parent b4a682df52
commit b97de29f74
3 changed files with 9 additions and 8 deletions

View File

@ -141,8 +141,8 @@ class StoreRecurringInvoiceRequest extends Request
if (isset($input['auto_bill'])) { if (isset($input['auto_bill'])) {
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
} else { } else {
/** @var \App\Models\Client $client */ if (array_key_exists('client_id', $input) && $client = Client::query()->find($input['client_id'])) {
if (array_key_exists('client_id', $input) && $client = Client::find($input['client_id'])) { /** @var \App\Models\Client $client */
$input['auto_bill'] = $client->getSetting('auto_bill'); $input['auto_bill'] = $client->getSetting('auto_bill');
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
} }

View File

@ -19,13 +19,14 @@ use Illuminate\Contracts\Validation\Rule;
*/ */
class CanStoreClientsRule implements 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) 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; return $this->company->clients()->count() < $this->company->account->hosted_client_count;
} }

View File

@ -84,7 +84,7 @@ class MatchBankTransactions implements ShouldQueue
{ {
MultiDB::setDb($this->db); 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) { if ($this->company->account->bank_integration_account_id) {
$yodlee = new Yodlee($this->company->account->bank_integration_account_id); $yodlee = new Yodlee($this->company->account->bank_integration_account_id);