$data = Category::join('articles', function ($join) {
$join->on('categories.id', 'articles.category_id')
->where('categories.type', 'news')
->where('articles.status', '1');
})->get()->sortByDesc('updated_at')->paginate(5);
I have 2 variables both querying the same model. I want to now merge these 2 separate datasets into a variable called $articles and then paginate on it.
Remove the get() method from the code like:
It should work.