Tuesday, March 21, 2017

MethodNotAllowedHttpException

I'm trying to update the fields in the database, but I couldn't

here is my routes :

Route::post('orders/show/{id}', [
'uses'   => 'OrderCommentsController@postOrder',
'as'     => 'order.show',
'before' => 'csrf|auth'    
]);

here the controller function:

        public function postOrder()
{
    $this->orderForm->validate(Input::all());

    $order = $this->orders->getNew([
        'link'       => Input::post('link'),
        'size'       => Input::post('size'),
        'color'       => Input::post('color'),
        'quantity'       => Input::post('quantity'),
        'ordernumber'       => Input::post('ordernumber'),
        'trackingnumber'       => Input::post('trackingnumber'),    
        'shipper'       => Input::post('shipper'),                  
        'status'        => Input::post('status')
    ]);

    $this->orders->save($order);

    return Redirect::back()->withMessage('Order has been updated');
}

here is the blade:


        <div class="box-body">
            <div class="row">
                <div class="col-lg-6">
                    <div class="form-group">

                        
                        
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="form-group">
                        
                        
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6">
                    <div class="form-group">
                        
                        
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="form-group">
                        
                        
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6">
                    <div class="form-group">
                            
                        
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="form-group">
                        
                        
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6">
                    <div class="form-group">
                        
                        
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="form-group">
                        
                        
                    </div>
                </div>

            </div>
              <div class="row">
                <div class="col-lg-6">
                    <div class="form-group">
                        
                    <select name="status" class="form-control">
                    <option value="0">1</option>
                    <option value="1">2</option>
                    <option value="2">3</option>
                    <option value="3">4</option>
                    <option value="4">5</option>
                    <option value="5">6</option>
                    <option value="6">7</option>
                </select>                        
                </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            
        </div>
        

so each time I try to update the order I got error "MethodNotAllowedHttpException ", I tried a lot of methods but I'm lost. I'm still beginner in php and this problem drive me crazy, so I'll be glad if you can help guys.

thanks



via rooot_999

Advertisement