如何在 laravel 的邮件中添加 accept/decline 按钮
How to add accept/decline button in mail in laravel
我正在做一个项目。在这个项目中,我希望提供者能够接受或拒绝从邮件中给他序列号的某人的序列号。但我被困在这个。我做不到。请帮我解决这个问题。
我的邮件功能是
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 15px; color: #57697e;">
Hello <strong>'.$provider_first_name.' '.$provider_last_name.'</strong>, <strong>'.$seeker_first_name.' '.$seeker_last_name.'</strong> wants to meet you on <strong>'.$booking_date.' at '.$booking_start_time.'-'.$booking_end_time.' </strong> by '.$booking_type.'. Please let us know
whether you will be available on the time specified.
You can accept or reject appointments: <a href="'. url('booking/accept/') .'/'.$provider.'">Accept</a>
Follow us on <a href="http://syncopp.devteam.website/">Sync Opp</a> for booking confirmation.
<br/>
Thank you for staying with us!
</span>
我的控制器是
public function accept($id)
{
if (Auth::check()) {
$booking = Booking::find($id);
if (!empty($booking)) {
$to = User::find($booking->seeker_id)->email;
$seeker_first_name = UserDetail::where('user_id', $booking->seeker_id)->first()->first_name;
$seeker_last_name = UserDetail::where('user_id', $booking->seeker_id)->first()->last_name;
$provider_first_name = UserDetail::where('user_id', $booking->provider_id)->first()->first_name;
$provider_last_name = UserDetail::where('user_id', $booking->provider_id)->first()->last_name;
$type = Meeting::where('id', $booking->meeting_type)->first()->name;
$link = 'http://devteam.website/esp+hadfkku+hhj2hjh2+q+web+video+calling/index.php?r=videochat/logout';
$token = $booking->token;
$subject = 'Syncopp : Meeting Confirmation!';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail = new Mail();
$body = $mail->accept_booking($seeker_first_name, $seeker_last_name, $provider_first_name, $provider_last_name, $type, $link,$token);
mail($to, $subject, $body, $headers);
$to_p = Auth::user()->email;
mail($to_p, $subject, $body, $headers);
$booking->is_accepted = 1;
$booking->notification = 0;
// Change payment status, just like booking status.
if($booking->save()){
$payment = Payment::where('booking_id', $id)->first();
if(!empty($payment)){
$payment->is_accepted = 1;
$payment->save();
}
}
} else {
}
} else {
}
}
这在我更改控制器后完美运行
public function accept($id)
{
if (!empty($id)) {
$booking = Booking::find($id);
if (!empty($booking)) {
$to = User::find($booking->seeker_id)->email;
$seeker_first_name = UserDetail::where('user_id', $booking->seeker_id)->first()->first_name;
$seeker_last_name = UserDetail::where('user_id', $booking->seeker_id)->first()->last_name;
$provider_first_name = UserDetail::where('user_id', $booking->provider_id)->first()->first_name;
$provider_last_name = UserDetail::where('user_id', $booking->provider_id)->first()->last_name;
$type = Meeting::where('id', $booking->meeting_type)->first()->name;
$link = 'http://devteam.website/esp+hadfkku+hhj2hjh2+q+web+video+calling/index.php?r=videochat/logout';
$token = $booking->token;
$subject = 'Syncopp : Meeting Confirmation!';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail = new Mail();
$body = $mail->accept_booking($seeker_first_name, $seeker_last_name, $provider_first_name, $provider_last_name, $type, $link, $token);
mail($to, $subject, $body, $headers);
$to_p = User::find($booking->provider_id)->email;;
mail($to_p, $subject, $body, $headers);
$booking->is_accepted = 1;
$booking->notification = 0;
// Change payment status, just like booking status.
if ($booking->save()) {
$payment = Payment::where('booking_id', $id)->first();
if (!empty($payment)) {
$payment->is_accepted = 1;
$payment->save();
}
}
echo "<script type='text/javascript'>window.close();</script>";
} else {
echo "<script type='text/javascript'>alert('Seeker not found.');window.close();</script>";
}
}else{
echo "<script type='text/javascript'>alert('Seeker not found.');window.close();</script>";
}
}
我正在做一个项目。在这个项目中,我希望提供者能够接受或拒绝从邮件中给他序列号的某人的序列号。但我被困在这个。我做不到。请帮我解决这个问题。 我的邮件功能是
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 15px; color: #57697e;">
Hello <strong>'.$provider_first_name.' '.$provider_last_name.'</strong>, <strong>'.$seeker_first_name.' '.$seeker_last_name.'</strong> wants to meet you on <strong>'.$booking_date.' at '.$booking_start_time.'-'.$booking_end_time.' </strong> by '.$booking_type.'. Please let us know
whether you will be available on the time specified.
You can accept or reject appointments: <a href="'. url('booking/accept/') .'/'.$provider.'">Accept</a>
Follow us on <a href="http://syncopp.devteam.website/">Sync Opp</a> for booking confirmation.
<br/>
Thank you for staying with us!
</span>
我的控制器是
public function accept($id)
{
if (Auth::check()) {
$booking = Booking::find($id);
if (!empty($booking)) {
$to = User::find($booking->seeker_id)->email;
$seeker_first_name = UserDetail::where('user_id', $booking->seeker_id)->first()->first_name;
$seeker_last_name = UserDetail::where('user_id', $booking->seeker_id)->first()->last_name;
$provider_first_name = UserDetail::where('user_id', $booking->provider_id)->first()->first_name;
$provider_last_name = UserDetail::where('user_id', $booking->provider_id)->first()->last_name;
$type = Meeting::where('id', $booking->meeting_type)->first()->name;
$link = 'http://devteam.website/esp+hadfkku+hhj2hjh2+q+web+video+calling/index.php?r=videochat/logout';
$token = $booking->token;
$subject = 'Syncopp : Meeting Confirmation!';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail = new Mail();
$body = $mail->accept_booking($seeker_first_name, $seeker_last_name, $provider_first_name, $provider_last_name, $type, $link,$token);
mail($to, $subject, $body, $headers);
$to_p = Auth::user()->email;
mail($to_p, $subject, $body, $headers);
$booking->is_accepted = 1;
$booking->notification = 0;
// Change payment status, just like booking status.
if($booking->save()){
$payment = Payment::where('booking_id', $id)->first();
if(!empty($payment)){
$payment->is_accepted = 1;
$payment->save();
}
}
} else {
}
} else {
}
}
这在我更改控制器后完美运行
public function accept($id)
{
if (!empty($id)) {
$booking = Booking::find($id);
if (!empty($booking)) {
$to = User::find($booking->seeker_id)->email;
$seeker_first_name = UserDetail::where('user_id', $booking->seeker_id)->first()->first_name;
$seeker_last_name = UserDetail::where('user_id', $booking->seeker_id)->first()->last_name;
$provider_first_name = UserDetail::where('user_id', $booking->provider_id)->first()->first_name;
$provider_last_name = UserDetail::where('user_id', $booking->provider_id)->first()->last_name;
$type = Meeting::where('id', $booking->meeting_type)->first()->name;
$link = 'http://devteam.website/esp+hadfkku+hhj2hjh2+q+web+video+calling/index.php?r=videochat/logout';
$token = $booking->token;
$subject = 'Syncopp : Meeting Confirmation!';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail = new Mail();
$body = $mail->accept_booking($seeker_first_name, $seeker_last_name, $provider_first_name, $provider_last_name, $type, $link, $token);
mail($to, $subject, $body, $headers);
$to_p = User::find($booking->provider_id)->email;;
mail($to_p, $subject, $body, $headers);
$booking->is_accepted = 1;
$booking->notification = 0;
// Change payment status, just like booking status.
if ($booking->save()) {
$payment = Payment::where('booking_id', $id)->first();
if (!empty($payment)) {
$payment->is_accepted = 1;
$payment->save();
}
}
echo "<script type='text/javascript'>window.close();</script>";
} else {
echo "<script type='text/javascript'>alert('Seeker not found.');window.close();</script>";
}
}else{
echo "<script type='text/javascript'>alert('Seeker not found.');window.close();</script>";
}
}