我正在調整Laravel 5.2中的開箱即用型AuthController以滿足我的需求。註冊新用戶時,不希望新用戶自動登錄。我已經通過在AuthController中覆蓋RedirectsUsers特徵中的postRegister方法來讀取,您可以改變工作流程。所以我的AuthController看起來像這樣:爲什麼重寫Laravel AuthController中的postRegister不起作用?
class AuthController extends Controller {
...
protected function create(array $data) {
}
public function postRegister(Request $request) {
$validator = $this->validator($request->all());
if ($validator->fails()) {
$this->throwValidationException(
$request, $validator
);
}
$this->create($request->all());
return redirect($this->redirectPath());
}
}
但是,我的postRegister方法似乎被忽略。我哪裏錯了?
如下面的答案是展示,缺省auth並不產生'postRegister',它會創建一個'register'的路線。 'php artisan route:list'來查看路由指向的方法。 – lagbox