MethodNotAllowedHttpException not found when I paginate in Laravel

Posted 2 years ago by alexshifu

Hello this is my first question here.

I am using php laravel framework and I am getting this error

MethodNotAllowedHttpException in RouteCollection.php line 233:

This error comes when I go to second page of the result list.

My controller code.


public function find_product(Request $request)
{
    $search = trim($request->product);

    $products = Store_product::(query-for-products-working)
        ->paginate(1);

    return view('fc.product',compact('products','search'));

}

My web.php code


Route::post('/product', '[email protected]_product');

My view code

@foreach($products as $product)
<div class="fc-col">
  <div class="panel panel-primary">
    <div class="panel-heading fc-col-head"><div class="marquee">{{ $product->product_name }}</div></div>
    <div class="panel-body fc-col-body">
        <img src="{{ image_check('uploads/store/products/',$product->product_image1,'uploads/service/') }}" class="img-responsive" style="width:100%; height: 100%;" alt="{{ $product->product_name }}" />
    </div>
    <div class="panel-footer fc-col-footer">
        <span class="price">Rs.
        {{ 
            price_check($product->product_discount, $product->product_price, $product->sale_id, $product->discount)
        }}/-
        </span>
    </div>
  </div>
</div>
@endforeach
<div>
    {{ $products->links() }}
</div>

and the form


<form action="/product" method="POST">
{{ csrf_field() }}  
<div class="input-group container">
  <input type="text" name="product" class="form-control" value="{{$search}}" placeholder="Enter product name" />
  <div class="input-group-btn">
    <input type="submit" class="btn btn-danger" value="Search" />
  </div>
</div>
</form>

Why my method is not allowed. And if this is not the method to use what should I do? Can anyone help me with this please? :(

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.