I want Data From Both Queries One After Another
->when($todayDate, function ($query) use ($todayDate) {
$query->whereDate('startdate', '>=', $todayDate)->orderBy('batches.startdate', 'desc');
})->when($todayDate, function ($query) use ($todayDate) {
$query->whereDate('startdate', '<=', $todayDate)->orderBy('batches.startdate', 'desc');
})
4
Answers
In Laravel, you can use the union() method to combine the results of two queries. Here’s an example:
This is How we can do without Union