A JOIN With Additional Conditions Using Query Builder or Eloquent
问题 I'm trying to add a condition using a JOIN query with Laravel Query Builder. <?php $results = DB::select(' SELECT DISTINCT * FROM rooms LEFT JOIN bookings ON rooms.id = bookings.room_type_id AND ( bookings.arrival between ? and ? OR bookings.departure between ? and ? ) WHERE bookings.room_type_id IS NULL LIMIT 20', array('2012-05-01', '2012-05-10', '2012-05-01', '2012-05-10') ); I know I can use Raw Expressions but then there will be SQL injection points. I've tried the following with Query