Tuesday, April 11, 2017

Route not going where it's supposed to

I'm getting this error. This error comes in when I hit the delete button

MethodNotAllowedHttpException in RouteCollection.php line 251:

the problem is as far as I know my routes is correct.

My cart.blade.php

@foreach($cartItems as $cartItem)
    <tr>
        <td>
            <img src="{!! asset("product_images/$cartItem->img") !!}" alt="..." class="img-responsive">
        </td>
        <td>{!! $cartItem->name !!}</td>
        <td>{!! $cartItem->qty !!}</td>
        <td>R {!! $cartItem->qty * $cartItem->price !!}</td>
        <td>
            {!! Form::open(array('method' => 'Delete', 'route' => array('deleting', $cartItem->rowId))) !!}
                <button class="btn btn-warning">Delete 2</button>
            {!! Form::close() !!}
        </td>
    </tr>
@endforeach

My routes

Route::put('/product/deleting/{id}', [
    'uses' => 'OpenController@deleting',
    'as' => 'deleting'
]);

my controller

public function deleting($id)
{
    echo "string";
}



via Isis

Advertisement