remove Mail use from Notifications classes
This commit is contained in:
@@ -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,
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user