C
C
copal2015-12-22 19:14:09
Laravel
copal, 2015-12-22 19:14:09

How to get object from model and get its properties?

There is a users table with data entered for the test. Now I'm trying to get the user I need by email and password -

$user = User::where(['password' => 'xxxxxx', 'email => '[email protected]']);

And I get an object that is not entirely clear, because of which I will stop my further reasoning and ask how to correctly make a selection and get its name from the object stored in $user?
And there was a doubt about the password, because it is hashed in the db, so I reduced the search to one email, but nothing has changed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-12-22
@copal

where() returns a query constructor object, the query itself has yet to be executed. Usually this is done via ->get() , but in this case it's better like this:
Well, in general, authentication is done like this .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question