The problem is that you have such code now:
WHERE foreignKey = X AND first_name = Y OR last_name = Z
So obviously it's not returning what it should.
Now, to make it work, you need to add those constraints as a sub where:
$bookings=$bookings->whereHas('client',function($q) use ($client_name){
$q->where( function ($q) use ($client_name) {
$q->where('first_name','LIKE',$client_name)
->orWhere('last_name','LIKE',$client_name);
});
});
This will result in a query like:
WHERE foreignKey = X AND (first_name = Y OR last_name = Z)
which is what you need.