Level 70
@mohammadbasir If you want to convert your raw query to eloquent, you need to use closures for that.
I can think of this one as of now. I guess it will be working. Try.
DB::table('chat')
->where(function($query) {
$query->where('id_participant1', 1)
->orWhere('id_participant2', 1);
})
->where(function($query) {
$query->where('id_participant1', 2)
->orWhere('id_participant2', 2);
})
->get();
Plz take a note that, the code hasn't tested. You might need to adjust.
3 likes