所以我在我的routes.php文件定义了这些路线:NotFoundHttpException在RouteCollection Laravel 5.2
Route::post('/register', 'Auth\[email protected]');
Route::post('/login', 'Auth\[email protected]');
Route::get('/verify/{$key}', 'Auth\[email protected]');
的前两部作品的罚款。但出于某种原因,第三个[/ verify/{$ key}]会抛出一个NotFoundHttpException异常。
验证路由在我的AuthController中调用Verify()函数,如下所示。
public function Verify($key)
{
$user = User::Where('verification_code', $key);
if(!$user)
{
flash()->error('Error Occurred in verification.');
return redirect('/login');
}
$user->verified = 1;
$user->verification_code = null;
$user->save;
flash()->success('Account Successfully Verified.');
return redirect('/login');
}
当从终端调用php artisan route:list时,出现verify/{key}。
任何帮助将不胜感激。
这是一个'GET'或'POST'请求吗? –
GET,我用链接向用户发送验证邮件,例如:www.example.com/verify/key_here – Riaan