matometaru
12/26/2017 - 11:15 AM

LaravelのQuery Builder

LaravelのQuery Builder使用例

$next = Goods::with('goods_image')
    -> select('name','goods.id','type')
    -> where('type',"1") ->where('service_type','like','%,10,%')->where('update_date', '<', $update_date)-> orderBy('update_date', 'desc')->get();
    -> where('type',$type) ->where('service_type','like','%,10,%')->where('update_date', '<', $update_date)-> orderBy('update_date', 'desc')->limit('1')->first();

// get()やfirst()などで取得することができる
echo "<pre>";
print_r($next);
echo "</pre>";