我試圖更新數據庫中的字段,但我不能MethodNotAllowedHttpException
這裏是我的路線:
Route::get('orders', [
'uses' => '[email protected]',
'as' => 'order.show'
]);
這裏的控制器:
public function postOrder()
{
$this->orderForm->validate(Input::all());
$order = $this->orders->getNew([
'link' => Input::post('link'),
'size' => Input::post('size'),
'color' => Input::post('color')
]);
$this->orders->save($order);
return Redirect::back()->withMessage('Order has been updated');
}
這裏刀片:
{{ Form::open() }}
<div class="box-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
{{ Form::label('title', 'Product:') }}
{{ Form::text('title', $order->title, ['class' => 'form-control', ]) }}
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
{{ Form::label('link', 'Link:') }}
{{ Form::text('link', $order->link, ['class' => 'form-control']) }}
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
{{ Form::label('size', 'Size:') }}
{{ Form::text('size', $order->size, ['class' => 'form-control']) }}
</div>
</div>
<div class="col-lg-6">
</div>
</div>
<div class="box-footer">
{{ Form::submit('Save', ['class' => 'btn btn-primary']) }}
</div>
{{ Form::close() }}
所以每次我嘗試更新命令時出現錯誤「MethodNotAllowedHttpException」,我嘗試了很多方法,但我迷路了。我仍然是PHP的初學者,這個問題讓我瘋狂,所以如果你能幫助你,我會很高興。
感謝
***我已經更新了代碼
@Kovah我已經完成了你建議的先生,現在我得到了這個錯誤「validation.required」,我想我知道如何解決,所以我會試一試。謝謝 –