Editing: ModelRepository.php
<?php namespace App\Repositories\Model; use App\Models\Account; use App\Models\Counterparty; use App\Models\Organization; use App\Models\System; use App\Repositories\Model\Interfaces\ModelInterface; use Illuminate\Support\Collection; class ModelRepository implements ModelInterface { public function getAccounts(int $modelId, $archive) { return Account::query()->where(['model_id' => $modelId, 'archived' => $archive])->with(['organization', 'payments'])->get(); } public function getCashAccounts(int $modelId, bool $isCash, bool $archive = false) { return Account::query()->where(['model_id' => $modelId, 'is_cash' => $isCash, 'archived' => $archive])->with(['organization', 'payments'])->get(); } public function getCounterparties($modelId, $archive) { return Counterparty::query()->where(['model_id' => $modelId, 'archived' => $archive])->get(); } public function getOrganizations($modelId, $archive) { return Organization::query()->where(['model_id' => $modelId, 'archived' => $archive])->get(); } public function getModel(int $modelId) { return System::query()->findOrFail($modelId); } public function getAll(): Collection { return System::query()->get(); } public function update(int $modelId, array $data) { return System::find($modelId)->update($data); } }
Save
Back