0

Laravel DB 怎样直接获取某一个字段的值?

eartha created at5 years ago view count: 2992
$user = DB::table('users')->where('id', 1)-first();
if(!empty($user)){
    $email = $user->email;
}
report
回复
0
$email = DB::table('users')->where('name', 'John')->value('email');
5 years ago 回复

Recent search keywords