Reputation: 393
I am trying to make a User object with a String as ID. Everything went fine, even authenticating. But whenever I am trying to get the currently logged in user his ID by either:
Auth::user()->id
or
Auth::id();
Both are returning '0'. Whenever I dump the Auth::user object I can actually see the id attribute correctly. Have I done something wrong?
Upvotes: 2
Views: 1151
Reputation: 18986
Laravel
tries to cast it to integer, simply put the following property in your User
class.
class User {
public $incrementing = false;
}
Upvotes: 4