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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -