update marketing
All checks were successful
All checks were successful
This commit is contained in:
@@ -14,10 +14,23 @@ public function view(): View
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('type', '!=', 'Supplier')
|
||||
->whereHas('sales')
|
||||
->when(request('search'), function ($q) {
|
||||
$q->where(function ($q) {
|
||||
$q->where('name', 'like', '%' . request('search') . '%')
|
||||
->orWhere('phone', 'like', '%' . request('search') . '%')
|
||||
->orWhere('email', 'like', '%' . request('search') . '%')
|
||||
->orWhere('type', 'like', '%' . request('search') . '%');
|
||||
});
|
||||
})
|
||||
->withCount('sales')
|
||||
->withSum('sales', 'totalAmount')
|
||||
->orderByDesc('sales_count')
|
||||
->orderByDesc('sales_sum_total_amount')
|
||||
->when(request('type'), function ($q) {
|
||||
$q->where(function ($q) {
|
||||
$q->where('type', request('type'));
|
||||
});
|
||||
})
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user