mardi 16 octobre 2018

Laravel: How do I get the ID of the model attached to the model being used

So, I have this line of code in my controller

$user = Auth::guard('api')->user();

this is on my AppUser.php model

public function user()
{
    return $this->belongsTo('App\Models\User', 'user_id');
}

when I try to do this:

$user = Auth::guard('api')->user()->pluck('uuid');

It returns the uuid of the AppUser. What I want is to get the UUID of the user. Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire