Created
April 27, 2018 04:43
-
-
Save kdes70/80f7de8134e2f44725c90810b8c25fdb to your computer and use it in GitHub Desktop.
#laravel #whereHas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// result WHERE foreignKey = X AND (first_name = Y OR last_name = Z) | |
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); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment