update marketing
All checks were successful
All checks were successful
This commit is contained in:
@@ -13,8 +13,20 @@ public function view(): View
|
||||
$customers = Party::with('sales')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('type', '!=', 'Supplier')
|
||||
->when(request('search'), function ($q) {
|
||||
$q->where(function ($q) {
|
||||
$q->where('name', 'like', '%' . request('search') . '%')
|
||||
->orWhere('phone', 'like', '%' . request('search') . '%')
|
||||
->orWhere('type', 'like', '%' . request('search') . '%');
|
||||
});
|
||||
})
|
||||
->when(request('type'), function ($q) {
|
||||
$q->where(function ($q) {
|
||||
$q->where('type', request('type'));
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->get();
|
||||
->limit(request('per_page') ?? 20)->get();
|
||||
|
||||
$totalAmount = $customers->sum(function ($customer) {
|
||||
return $customer->sales?->sum('totalAmount') ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user