Laravel-从数据库返回空值

时间:2020-01-28 19:45:59

标签: database laravel-5 null return-value

我从数据库的列中获取“ is null”值,如何找出原因?

控制器:

public function getValues(Request $request)
    $node_id = floor($day);
    $sub_id = $day;
    $mtime = $request->mtime;
    $silent_data = Auth::user()->lessons()->where('mtime',$mtime)->where('sub_id',$sub_id)->where('node_id',$node_id)->first();

表课程:

id int(10)
user_id int(10)
node_id int(10)
sub_id varchar(191)
mtime int(10)

laravel控制台:

select * from `lessons` where `lessons`.`user_id` = 11382 and `lessons`.`user_id` is not null and **`mtime` is null** and `sub_id` = '1.4' and `node_id` = 1

表课程列mtime的值为10

0 个答案:

没有答案