【发布时间】:2016-06-17 04:46:52
【问题描述】:
所以我在我的 routes.php 中定义了这些路由:
Route::post('/register', 'Auth\AuthController@Register');
Route::post('/login', 'Auth\AuthController@Login');
Route::get('/verify/{$key}', 'Auth\AuthController@Verify');
前两个工作正常。但是由于某种原因,第三个 [ /verify/{$key} ] 抛出了 NotFoundHttpException。
verify 路由调用我的 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
标签: php laravel laravel-5.2