pentium
4 months ago
366
5
Laravel

Pagination links() method doesn't exist

Posted 4 months ago by pentium

i have seen so many related topics to this problem but i could not find the solution. i am using pagination with eloquent but on my view i can not have access to the method links()

 public function myadd( Request $request ){

      $ads = ads::where("userId",Auth::user()->id)->paginate(3); 
     return view('clients.myadd')->with("ads",$ads);
 }

this is my view :

 @foreach($ads as $ads)

          <div class="m-0">
                <button  class="btn myadd-btn btn-primary btn-sm" type="button"  >View</button> 
                <button  class="btn myadd-btn btn-primary btn-sm" type="button"  >Update</button> 
                <button  class="btn myadd-btn btn-primary btn-sm" type="button"  >Sold Out</button> 
                <button  class="btn myadd-btn btn-primary btn-sm" type="button"  >Delete</button> 
            </div>

          <div class="container myaddContainer">
            <div class="row">
              <div class="col-md-2 col-lg-2 p-0" >
               <img src="publication/{{$ads->pict1}}" width="100px"; height="109px;">
              </div>
              <div class="col-md-10 col-lg-10 m-0 p-0" >
                <div class="row m-0 p-0">
                 <h5>{{$ads->title}} 
                  (@if($ads->isUsed==0)
                  {{"New"}}
                  @else
                  {{"Used"}}
                  @endif)
                </h5> 
                </div>
                <div class="row m-0 p-0" >
                  <span>{{$ads->cityName}} </span> &nbsp;&nbsp;||&nbsp;&nbsp;<span> {{$ads->subCategoryName}}</span>
                  
                </div>
                <div class="row m-0 p-0" >
                  <span class="price" >{{$ads->price}} TK</span> <span class="time">{{$ads->created_at->diffForHumans()}}</span>
                  
                </div>
                
              </div>
              
            </div>
            
          </div> 
          @endforeach
          {{ $ads->links() }}

the error i am getting:

Call to undefined method App\ads::links() (View: D:\xamp\htdocs\bigdeals.com\resources\views\clients\myadd.blade.php)

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