@ -23,6 +23,7 @@ Hydra is a zero-config API boilerplate with Laravel Sanctum and comes with excel
- [Delete a Role (Admin Ability Required)](#delete-a-role-admin-ability-required)
- [Delete a Role (Admin Ability Required)](#delete-a-role-admin-ability-required)
- [List Available Roles of a User (Admin Ability Required)](#list-available-roles-of-a-user-admin-ability-required)
- [List Available Roles of a User (Admin Ability Required)](#list-available-roles-of-a-user-admin-ability-required)
- [Assign a Role to a User (Admin Ability Required)](#assign-a-role-to-a-user-admin-ability-required)
- [Assign a Role to a User (Admin Ability Required)](#assign-a-role-to-a-user-admin-ability-required)
- [Delete a Role from a User (Admin Ability Required)](#delete-a-role-from-a-user-admin-ability-required)
## Getting Started
## Getting Started
@ -456,7 +457,7 @@ To assign a role to a user, make an `HTTP POST` request to the following route,
http://localhost:8000/api/users/{userid}/roles
http://localhost:8000/api/users/{userid}/roles
```
```
For example to assign a role the user with id 2, use this endpoint `http://localhost:8000/api/users/2/roles`
For example to assign a role to the user with id 2, use this endpoint `http://localhost:8000/api/users/2/roles`
**API Payload & Response**
**API Payload & Response**
@ -505,4 +506,48 @@ For any unsuccsesful attempt or wrong token, you will receive a 401 error respon
}
}
```
```
### Delete a Role from a User (Admin Ability Required)
To delete a role from a user, make an `HTTP DELETE` request to the following route, with Admin Token obtained from Admin Login. Add this token as a standard `Bearer Token` to your API call. Replace `{userid}` with an actual user id, and `{role}` with an actual role id