Jamie
Jamie

Reputation: 10896

Laravel user info not

In my api I say this:

public function internInfo($id)
{
   $user = User::where('EmployeeId','=',$id);
   dd($user->LastName);
}

The user is found but it can't get the LastName, but LastName exist!

What am I doing wrong?

Upvotes: 1

Views: 15

Answers (1)

Damien Pirsy
Damien Pirsy

Reputation: 25435

You forgot to take the results...Should be:

   $user = User::where('EmployeeId','=',$id)->first();

Upvotes: 2

Related Questions