Laravel 5.1 将数据传递到邮件视图不起作用
Laravel 5.1 passing data to mail view doesn't work
因此,我正在尝试使用用户发布的数据创建电子邮件视图。问题是,无法访问特定数据。我不知道我应该如何获得这些数据。
这是我的控制器:
public function PostSignupForm(Request $request)
{
// Make's messages of faults
$messages = [
//removed them to save space
];
//Validation rules
$rules = [
//removed them to save space
];
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
}
DB::table('rittensport')->insert([
'note' => $request->get('note'),
//standard instert
]);
/**
* Sending the e-mails to the pilot and co-pilot
*
* @return none
*/
Mail::send('emails.rittensport_signup', $request->all(), function ($message) {
$message->from(env('APP_MAIL'), 'RallyPodium & Reporting');
$message->sender(env('APP_MAIL'), 'RallyPodium & Reporting');
$message->to($request->get('piloot_email'), strtoupper($request->get('piloot_lastname')).' '.$request->get('piloot_firstname'));
$message->to($request->get('navigator_email'), strtoupper($request->get('navigator_lastname')).' '.$request->get('navigator_firstname'));
$message->subject('Uw inschrijving voor de RPR Gapersrit '. date('Y'));
$message->priority(1);//Highest priority (5 is lowest).
});
return Redirect::back();
好吧,视图存在,我面临的错误是:
Undefined variable: request
.
这是我尝试在电子邮件视图中获取数据的方式:{{ $request->get('note') }}
我已经尝试过 {{ $message->note }}
、$message['note']
等等。
试试这个:
Mail::send('emails.rittensport_signup', array("request" => $request), function (...
因此,我正在尝试使用用户发布的数据创建电子邮件视图。问题是,无法访问特定数据。我不知道我应该如何获得这些数据。
这是我的控制器:
public function PostSignupForm(Request $request)
{
// Make's messages of faults
$messages = [
//removed them to save space
];
//Validation rules
$rules = [
//removed them to save space
];
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
}
DB::table('rittensport')->insert([
'note' => $request->get('note'),
//standard instert
]);
/**
* Sending the e-mails to the pilot and co-pilot
*
* @return none
*/
Mail::send('emails.rittensport_signup', $request->all(), function ($message) {
$message->from(env('APP_MAIL'), 'RallyPodium & Reporting');
$message->sender(env('APP_MAIL'), 'RallyPodium & Reporting');
$message->to($request->get('piloot_email'), strtoupper($request->get('piloot_lastname')).' '.$request->get('piloot_firstname'));
$message->to($request->get('navigator_email'), strtoupper($request->get('navigator_lastname')).' '.$request->get('navigator_firstname'));
$message->subject('Uw inschrijving voor de RPR Gapersrit '. date('Y'));
$message->priority(1);//Highest priority (5 is lowest).
});
return Redirect::back();
好吧,视图存在,我面临的错误是:
Undefined variable: request
.
这是我尝试在电子邮件视图中获取数据的方式:{{ $request->get('note') }}
我已经尝试过 {{ $message->note }}
、$message['note']
等等。
试试这个:
Mail::send('emails.rittensport_signup', array("request" => $request), function (...