feat: Implement order and invoice management, enhance addon features, and remove the 'Type' module.

This commit is contained in:
pbao9
2026-02-11 17:02:07 +07:00
parent 58a9aa685b
commit 556b2c02e6
47 changed files with 1367 additions and 497 deletions
+28 -9
View File
@@ -11,16 +11,35 @@ class AddonRepository extends BaseRepository implements AddonRepositoryInterface
{
return Addon::class;
}
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
{
$model = $this->model->with($relationships)->select($select);
if (count($withCount) > 0) {
$model = $model->withCount($withCount);
public function filter(
array $data = [],
array $relationships = [],
array $withCount = [],
array $select = ['*'],
bool $returnQuery = false
) {
$query = $this->model
->select($select)
->with($relationships);
if (!empty($data['vcenter_id'])) {
$query->where('vcenter_id', $data['vcenter_id']);
}
if(isset($data['page'])) {
return $model->paginate(15);
if (!empty($withCount)) {
$query->withCount($withCount);
}
return $model->get();
if ($returnQuery) {
return $query;
}
if (!empty($data['paginate'])) {
return $query->paginate(
$data['per_page'] ?? 15
);
}
return $query->get();
}
}