Alpha0_0's avatar

pagination not working

Hi, I am new to laravel and i am getting problem when fetching data according to tags with pagination. Can someone assist me right way? But when i paginate it shows errors

public function getTagsBySlug($slug){
    $tags = Tags::with('posts')->where('tag_slug','=',$slug)->where('tag_status',1)->first();
    $data['tags'] = $tags;
    $data['heading'] = $tags->tag_name;
    return view('blog.pages.tags',$data);
}
0 likes
2 replies
jlrdw's avatar

Where are you using paginate()?

fancyuserid's avatar

first() returns only 1 record. Why paginate if you are retrieving only 1 record?

Please or to participate in this conversation.