samedi 19 octobre 2019

Laravel API Resources: Different returns based on user role

This is the first time I am using Api Resource in Laravel 5.8 to return data to an application. There is a User model contains some public and private information about a user. A user is allowed to see all his/her information (same as name, phone number, email, ...) but others are allowed to see only the name and username. How can I handle this in Api Resource?

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire