0
I am using Laravel and I need to create an attribute (is_me) in the model to know if the current profile belongs to the user who is logged in;
I was doing as below, but now that I am using API I can no longer use Auth::user()
public function getIsMeAttribute(){
return \Auth::user()->id == $this->id;
}
How do you authenticate your user? JWT? Oauth? How is the security of your API?
– Ademir Mazer Jr - Nuno
I’m using the token method - I’m not sure if this fits Oauth
– Neimeg
So this token is probably related to the user who is authenticated, right? If it would not be interesting to do so, when generating the token relate to the user, this way before performing the test you put in code, search the user authenticated by the token and then test if the ids are equal
– Ademir Mazer Jr - Nuno