php - Laravel Eloquent ORM: Accessing a specific cell of table -
i trying access specific cell of table. have run following query in laravel eloquent orm:
select email users id=$id; here have done far:
$user=new users;//users model $user=users::where('email',$email) ->where('password',$pass) ->get(); $mail=$user->email; and encounter error:
errorexception in homecontroller.php line 52: undefined property: illuminate\database\eloquent\collection::$email
any help?
figured i'd put answer else comes looking -
->get() returns collection, ->first() returns model.
either replace ->get() ->first(), or $user->first()->email.
Comments
Post a Comment