点击领取淘宝京东拼多多唯品会优惠券
failException
设置查询数据为空时是否需要抛出异常,用于select
和find
方法,例如:
Db::name('blog')
->where('status',1)
->failException()
->select();
Db::name('blog')
->where('status',1)
->failException(false)
->select();
复制
或者可以使用更方便的查空报错
Db::name('blog')
->where('status', 1)
->selectOrFail();
Db::name('blog')
->where('status', 1)
->findOrFail();
复制