feat: Implement invoice creation functionality and integrate DataTables for invoice listing with dynamic column rendering.
This commit is contained in:
@@ -12,10 +12,13 @@ class InvoiceRepository extends BaseRepository implements InvoiceRepositoryInter
|
||||
{
|
||||
return Invoice::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);
|
||||
|
||||
if (isset($data['client']) && ! empty($data['client'])) {
|
||||
$model = $model->where("customer_id", $data['client']);
|
||||
}
|
||||
if (isset($data['invoice_type'])) {
|
||||
$model = $model->where("invoice_type", $data['invoice_type']);
|
||||
}
|
||||
@@ -86,6 +89,11 @@ class InvoiceRepository extends BaseRepository implements InvoiceRepositoryInter
|
||||
if (count($withCount) > 0) {
|
||||
$model = $model->withCount($withCount);
|
||||
}
|
||||
|
||||
if ($returnQuery) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
if (isset($data['limit']) && $data['limit']) {
|
||||
return $model->latest('id')->take($data['limit'])->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user