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