remove Mail use from Notifications classes

This commit is contained in:
2026-03-28 16:37:02 +01:00
parent f13e96c7c7
commit 4c52fa5043
10 changed files with 91 additions and 111 deletions
+14
View File
@@ -2,7 +2,9 @@
namespace App\Http\Controllers;
use App\Mail\EventParticipationCancelledMail;
use App\Models\Event;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
use App\Models\Task;
use App\Notifications\EventDeleted;
@@ -94,6 +96,18 @@ class EventsController extends Controller
if ($participants->isNotEmpty()) {
Notification::send($participants, new EventDeleted($event));
foreach ($participants as $user) {
if ($user->email_notifications) {
Mail::to($user->email)->send(new EventParticipationCancelledMail([
'name' => $user->name,
'lastname' => $user->lastname,
'eventName' => $event->name,
'start' => $event->start,
'end' => $event->end,
]));
}
}
}
}