Here is my current queries:
$q = $request->q;
-- first table
$n_arr = news::where('title','like',$q)->orWhere('description','like',$q)->get();
-- second table
$p_arr = productions::where('title','like',$q)->orWhere('description','like',$q)->get();
as you see, currently I do that by two different queries. But now I need to use ->paginate()
, So I need a single query to paging all results as well. I need something like union
clause.
In other word, I need to combine the result of those two queries above.
How can I do that in Laravel?