我正在使用laravel 5.3。因为我有邮件功能,变量在邮件功能不起作用后得到,下面是我的控制器编码
public function checkEmail(Request $request) {
$email = $request->input('email');
$users = Student::where('email', $email)->select('email')->first();
if(count($users) > 0){
$id =Student::where('email',$email )->value('id');
$url=url('/').'/password-reset/'.$id;
Mail::send('/resetpassword', ['email'=>$email,'url'=>$url ], function($message)
{
$message->to(Input::get('email'))->subject('Reset Password');
});
return redirect()->back()->with('message', 'Link has been sent to your Mail');
} else {
return redirect()->back()->with(['message' => 'No Records Found']);
}
}
我在邮件功能之前获得了所有变量值(即,)
邮件::发送(' / resetpassword',['电子邮件' => $ email,' url' => $ url],功能( $消息) { $ message-> to(Input :: get(' email')) - > subject(' Reset Password'); });
我得到了这样的错误
Class' App \ Http \ Controllers \ Input'找不到
如果我使用任何变量,则错误就像这样
未定义的变量:url
请有人告诉我我做错了什么......