We are building APIs for our App which uses Laravel and Vue.
I have three types of Users
Admin
Brand
Influencer End-User
We are using a single table to store all the Users and have role-based differentiation. While designing the SPI endpoints should we design three resources for the three types of users and another resource called Session or User for the logged-in user?
How do you guys design a restful API when you have multiple user roles?
As I my understanding you can do one think, in login response you can add the user type in response Like type: "user" and based on that you can define routes like Route::any('get/{type}/profile'). This is long way but you get the user type in URL.
Second way is when someone call the API and they have to pass one parameter like type: "user" and you can access it in $request parameter.
So, login API is common for all user type and based on response next API will called!