Last active
April 19, 2016 19:39
-
-
Save AleeRojas/56e48f92efaf9ef51ae96f59e187dd55 to your computer and use it in GitHub Desktop.
Left Join Laravel
This file contains hidden or 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
<?php | |
$model = $model->leftJoin('history', function ($join) { | |
$join->on('history.record_id', '=', 'work_order.work_order_id'); | |
$join->where('history.tablename', '=', 'test'); | |
$join->where('history.columnname', '=', 'column'); | |
$join->where(DB::raw('(`history`.`value_from` = 0 or `history`.`value_from` = "")'), '', ''); | |
$join->where('history.value_to', '>', '0'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment