update logic call

This commit is contained in:
pbao9
2026-01-31 10:08:25 +07:00
parent 72b690f22e
commit 669ed87a05
144 changed files with 600 additions and 12093 deletions
@@ -11,21 +11,26 @@ class FolderRepository extends BaseRepository implements FolderRepositoryInterfa
{
return ModuleFolder::class;
}
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'], bool $returnQuery = false)
{
$model = $this->model->with($relationships)->select($select);
$query = $this->model->with($relationships)->select($select);
if (isset($data['module_datacenter_id']) && $data['module_datacenter_id']) {
$model = $model->where("module_datacenter_id", $data['module_datacenter_id']);
$query->where("module_datacenter_id", $data['module_datacenter_id']);
}
if (count($withCount) > 0) {
$model = $model->withCount($withCount);
$query->withCount($withCount);
}
if (isset($data['page'])) {
return $model->paginate(15);
if ($returnQuery) {
return $query;
}
return $model->get();
if (!empty($data['paginate'])) {
return $query->paginate(
$data['per_page'] ?? 15
);
}
return $query->get();
}
public function findBy(string $key = '', string|int|null $value = '')
{