我有這個代碼在以前的版本工作,現在不再工作。我在做簡單的用戶authourization這樣的:Laravel 4.2拋出MethodNotAllowedHttpException
形式:
{{ Form::open(array(
'url' => 'login',
'method' => 'PUT',
'class' => 'pure-form pure-form-stacked'
)) }}
{{ $errors->first('email') }}
{{ $errors->first('password') }}
{{ Form::text('email', Input::old('email'), array('placeholder' => 'user')) }}
{{ Form::password('password', array('placeholder' => 'password')) }}
{{ Form::submit('Log in', array('class'=>'button-primary')) }}
{{ Form::close() }}
路線:
Route::get('login', array('https', function(){
return View::make('back-end/login');
}));
Route::post('login', array('https', function(){
$userdata = array(
'email' => Input::get('email'),
'password' => Input::get('password')
);
if(Auth::attempt($userdata)){
return Redirect::to('dashboard');
} else {
return Redirect::to('login');
}
}));
Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function(){
Route::get('/', '[email protected]');
Route::resource('blog', 'BlogController');
Route::get('logout', [
'as' => 'logout',
'uses' => '[email protected]'
]);
});
登錄頁面將加載,但是當我提交I輸出MethodNotAllowedHttpException得到。
將方法從'put'改爲'post'。 – itachi