当记录存储在数据库中但收到无法访问的语句时,我正在尝试执行发送邮件功能
public function store(Request $request)
{
$visit = Visit::create($request->all());
return response()->json($visit);
$this->sendEmail($request);
}
这是发送电子邮件功能
public function sendEmail(Request $request){
$visit = Visit::create($request->all());
$host_email = Db::table('users')
->where('name', '=', $visit->visitor_host)
->value('email');
$to_name = $request->input('visitor_name');
$data = array('name'=> $to_name, "body" => "Test mail");
Mail::send('mails.mail', $data, function($message) {
$message->from('cytonnvisitor@gmail.com','cytonn');
$message->to('mimikiduchu@gmail.com');
$message->subject('Visitor coming notification');
});
}
Smart猫小萌
海绵宝宝撒