'Send email using data from pivot table
I want to ask for help regarding my project. I want to send emails to all users that have a certain group_id.
This is my pivot table
For example, I want to send an email to all users who have group_id = 1, so how do I want to call the email column in the User table with the respective condition?
$group = Group::find($req->groupID);
Mail::send('newmeetingEmail', array(
'groupName' => $req->groupName,
'meetingDate' => $req->meetingDate,
'meetingTime' => $req->meetingTime,
'meetingDesc' => $req->meetingDesc,
'meetingLink' => $req->meetingLink,
'meetingModerator' => $req->meetingModerator,
), function ($message) use ($group) {
$message->from('[email protected]');
$message->to($group->creator->email)->subject('Class session');
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
