failException (chain operation 20)
Used for select and find methods, for example:
// 数据不存在的话直接抛出异常 Db::name('blog') ->where('status',1) ->failException() ->select(); // 数据不存在返回空数组 不抛异常 Db::name('blog') ->where('status',1) ->failException(false) ->select();
Or you can use the more convenient error checking
// 查询多条 Db::name('blog') ->where('status', 1) ->selectOrFail(); // 查询单条 Db::name('blog') ->where('status', 1) ->findOrFail();