send email to user framework laravel
Budget: $10 – $30 CAD
i have project laravel its have functions Send Notification
i need when send Notification also send this message to email user just this
my functions :
public function admSendMsg(Request $req)
{
if (Session::has('adm') && !empty(Session::get('adm'))) {
$adm = Session::get('adm');
$validator = Validator::make($req->all(), [
'subject' => 'required|min:5|max:50|string',
'msg' => 'required|string'
]);
if ($validator->fails()) {
return back()->With([
'toast_msg' => __('messages.msg_err') . ' ' . $validator->errors()->first(),
'toast_type' => 'err'
]);
}
try {
if (empty($req->input('msg_state'))) {
$msg = new msg;
$msg->message = $req->input('msg');
$msg->subject = $req->input('subject');
if (!empty($req->input('msg_users'))) {
$msg->users = $req->input('msg_users') . ';';
}
$msg->save();
$act = new adminLog;
$act->admin = $adm->email;
$act->action = __('messages.adm_snt_notf');
$act->save();
} else {
$msg = msg::find($req->input('msg_state'));
$msg->message = $req->input('msg');
$msg->subject = $req->input('subject');
$msg->readers = '';
if (!empty($req->input('msg_users'))) {
$msg->users = $req->input('msg_users');
} else {
$msg->users = NULL;
}
$msg->save();
$act = new adminLog;
$act->admin = $adm->email;
$act->action = __('messages.adm_updt');
$act->save();
}
return back()->With([
'toast_msg' => __('messages.snt_succf'),
'toast_type' => 'suc'
]);
} catch (\Exception $e) {
return back()->With([
'toast_msg' => __('messages.err_savn_msg') . $e->getMessage(),
'toast_type' => 'err'
]);
}
} else {
return redirect('/login');
}
}
i need when send Notification also send this message to email user just this
my functions :
public function admSendMsg(Request $req)
{
if (Session::has('adm') && !empty(Session::get('adm'))) {
$adm = Session::get('adm');
$validator = Validator::make($req->all(), [
'subject' => 'required|min:5|max:50|string',
'msg' => 'required|string'
]);
if ($validator->fails()) {
return back()->With([
'toast_msg' => __('messages.msg_err') . ' ' . $validator->errors()->first(),
'toast_type' => 'err'
]);
}
try {
if (empty($req->input('msg_state'))) {
$msg = new msg;
$msg->message = $req->input('msg');
$msg->subject = $req->input('subject');
if (!empty($req->input('msg_users'))) {
$msg->users = $req->input('msg_users') . ';';
}
$msg->save();
$act = new adminLog;
$act->admin = $adm->email;
$act->action = __('messages.adm_snt_notf');
$act->save();
} else {
$msg = msg::find($req->input('msg_state'));
$msg->message = $req->input('msg');
$msg->subject = $req->input('subject');
$msg->readers = '';
if (!empty($req->input('msg_users'))) {
$msg->users = $req->input('msg_users');
} else {
$msg->users = NULL;
}
$msg->save();
$act = new adminLog;
$act->admin = $adm->email;
$act->action = __('messages.adm_updt');
$act->save();
}
return back()->With([
'toast_msg' => __('messages.snt_succf'),
'toast_type' => 'suc'
]);
} catch (\Exception $e) {
return back()->With([
'toast_msg' => __('messages.err_savn_msg') . $e->getMessage(),
'toast_type' => 'err'
]);
}
} else {
return redirect('/login');
}
}