2
当我需要在laravel中创建某种形式的表单时,我使用单一路由进行表单显示和保存。出于这个原因,我需要使用Route::any('login', '[email protected]')
这不正确。Laravel:在单一路径中的表单显示和逻辑
比如我典型的登录表单控制器的方法:
public function login()
{
// handle submit
if(\Input::isMethod('post'))
{
if(\Auth::attempt(array('username' => \Input::get('username'), 'password' => \Input::get('password'))))
{
return \Redirect::intended('profile');
} else {
return \Redirect::back()->withInput()
->withErrors(['auth-validation' => 'Invalid username or password']);
}
}
// show form
$this->layout->content = \View::make('frontend/login');
}
的问题是:有没有其他Route::any
或任何东西,我不能从长远来看想到的任何安全隐患?
没知道有这样的方法,这似乎是更好的方法来路由这种事情,非常感谢! – insanebits