$result = BookCode::where('book_name','s121212ss')->get(); if ($result) { return [ 'd' => $result, 'c' => 200000, 'm' => '获取成功', ];} else { return [ 'c' => 400000, 'm' => '', 'd' => $result, ];}
因为返回的是一个 Collection,是一个非空对象
if ($result->isNotEmpty()) { // ok } else { // false }
1.4m articles
1.4m replys
5 comments
57.0k users