feat: Implement new admin API endpoints for product, customer, vCenter, and authentication, and add vCenter resource management UI.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Admin\Invoice;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
|
||||
class AdminInvoiceRepository implements AdminInvoiceRepositoryInterface
|
||||
{
|
||||
public function paginate(array $filters, int $perPage): LengthAwarePaginator
|
||||
{
|
||||
$query = Invoice::with('customer')->orderBy('id', 'desc');
|
||||
|
||||
if ($filter = $filters['filter'] ?? null) {
|
||||
$query->where(function ($q) use ($filter) {
|
||||
$q->where('order_num', 'like', "%{$filter}%")
|
||||
->orWhereHas('customer', fn($q2) =>
|
||||
$q2->where('fullname', 'like', "%{$filter}%")
|
||||
->orWhere('email', 'like', "%{$filter}%")
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (($status = $filters['status'] ?? null) !== null && $status !== '') {
|
||||
$query->where('status', (int) $status);
|
||||
}
|
||||
|
||||
return $query->paginate($perPage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user