Laravel Checking If a Record Exists

后端 未结 26 2068
礼貌的吻别
礼貌的吻别 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:25

    This will check if particular email address exist in the table:

    if (isset(User::where('email', Input::get('email'))->value('email')))
    {
        // Input::get('email') exist in the table 
    }
    
    0 讨论(0)
  • 2020-11-28 18:26

    here is a link to something l think can assist https://laraveldaily.com/dont-check-record-exists-methods-orcreate-ornew/

    0 讨论(0)
提交回复
热议问题