0

I have made my navigation file a partial file because it is commonly needed in every pages. In navigation bar there are lists of categories displayed. When i click one of the categories, i want to it to display it in another pages. For that i need to send id form that navigation bar categories. I tried to send id from the navigation bar then it shows error like Missing required parameters for [Route: details] [URI: HamroBazar/details/{id}]. (View: C:\xampp\htdocs\hamrobazarfinal\resources\views\Frontend\partial\loggedinnavigation.blade.php) (View: C:\xampp\htdocs\hamrobazarfinal\resources\views\Frontend\partial\loggedinnavigation.blade.php) (View: C:\xampp\htdocs\hamrobazarfinal\resources\views\Frontend\partial\loggedinnavigation.blade.php)

Here are some code

Navigation bar code (This is the partial file)
<div class="w3layouts-breadcrumbs">
    <div class="container-fluid">
      <span class="agile-breadcrumbs">
      <span class="categories1" >All Categories<i class="fa fa-chevron-down"></i></span>   
      @foreach($categoriespostcount as $cn)
      <a href="{{route('details',['id'=>$cn->id])}}">{{$cn->categoryname}}<span>({{$cn->postads->count()}})</span></a> 
      @endforeach
    </div>
  </div>

Web.php

Route::get('details/{id}','Detail\DetailController@details')->name('details');

Controller

 public function details($id)
    {
        dd($id);
        return view('Frontend.pages.detail.detail');
    }
7
  • Can you dd($categoriespostcount) to ensure it has the id property intact? Possibly you are sending a request to details/undefined ?
    – ajthinking
    Sep 19, 2019 at 8:41
  • @Anders It shows LengthAwarePaginator but the page contents are overflown.
    – A4family
    Sep 19, 2019 at 8:47
  • Are you using an API to get the data? Not 100% sure, but I think you want to get the "data" key from the paginator object.
    – ajthinking
    Sep 19, 2019 at 8:51
  • @Anders Nope nothing like that
    – A4family
    Sep 19, 2019 at 8:53
  • 1
    @Anders I got the Solution. Thank you for your time and response.
    – A4family
    Sep 19, 2019 at 9:02

1 Answer 1

1

I didn't know i have to put '?' in the route.

Route::get('details/{id?}','Detail\DetailController@details')->name('details');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.