I want to create leftjoin with pagination on laravel. how to create pagination with leftjoin ?
Here my code :
$news = News::leftJoin('categories','news.category_id', '=', 'categories.id')
->select('news.*' ,'categories.category')
->get()->sortByDesc('created_at');
Previously, i use $news = News::paginate(10);
and its works, but it without leftjoin.
and here my html code to create pagination
{{$news->links('vendor.pagination.pagination')}}