AleeRojas
4/19/2016 - 7:39 PM

Left Join Laravel

Left Join Laravel

<?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');
});