refactor(overview): untuk top customer itu by barber jika yang login nya barber
This commit is contained in:
parent
769c813d7b
commit
f404a76933
@ -74,6 +74,9 @@ public function index()
|
|||||||
DB::raw('COUNT(*) as transaction_count')
|
DB::raw('COUNT(*) as transaction_count')
|
||||||
)
|
)
|
||||||
->orderBy('total_transaction', 'desc')
|
->orderBy('total_transaction', 'desc')
|
||||||
|
->when(auth()->user()->role_id === 5, function ($query) {
|
||||||
|
return $query->where('user_id', auth()->id());
|
||||||
|
})
|
||||||
->limit(5)
|
->limit(5)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user