繁体   English   中英

Laravel雄辩的OR查询

[英]Laravel Eloquent OR query

我有要查询的'scaned_at'列模型:

$properties = Property::where(function($query) {
        $query->where('scaned_at', null)->orWhere('scaned_at', '<', Carbon::now());
    });

但这不起作用,我也不知道为什么...

您必须添加->get(); 最后像:

$properties = Property::where(function($query) {
    $query->where('scaned_at', null)->orWhere('scaned_at', '<', Carbon::now());
})->get();

另外,您可以在不使用函数的情况下执行此操作:

    $properties = Property::where('scaned_at', null)->orWhere('scaned_at', '<', Carbon::now())->get();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM