update logic call
This commit is contained in:
@@ -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 = '')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user