Laravel Checking If a Record Exists

后端 未结 26 2283
礼貌的吻别
礼貌的吻别 2020-11-28 17:50

I am new to Laravel. Please excuse the newbie question but how do I find if a record exists?

$user = User::where(\'em         


        
26条回答
  •  迷失自我
    2020-11-28 18:15

    It's simple to get to know if there are any records or not

    $user = User::where('email', '=', Input::get('email'))->get();
    if(count($user) > 0)
    {
    echo "There is data";
    }
    else
    echo "No data";
    

提交回复
热议问题