fix: remove n+1 absence notification
Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
parent
66f6b9ffd0
commit
27ba576678
@ -57,9 +57,12 @@ class AbsenceService
|
||||
'status' => 'PENDING',
|
||||
]);
|
||||
|
||||
foreach(User::role('admin')->get() as $admin) {
|
||||
$admin->notify(new NewAbsenceRequest($absence));
|
||||
}
|
||||
User::whereHas('roles', function ($q) {
|
||||
$q->where('name', 'admin');
|
||||
})->get()->each(function ($user, $key) use ($absence) {
|
||||
$user->notify((new NewAbsenceRequest($absence)));
|
||||
});
|
||||
|
||||
|
||||
Log::info('Processing new leave of absence request.', [
|
||||
'requesting_user' => $requester->email,
|
||||
|
Loading…
x
Reference in New Issue
Block a user