Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
peripherad
/
back
/
app
/
Console
:
ModelRepository.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?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); } }