mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Fixed api token endpoint documentation
This commit is contained in:
committed by
Constantin Graf
parent
4ea55e5867
commit
69a8c8bb2b
@@ -59,11 +59,13 @@ class ApiTokenController extends Controller
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*/
|
||||
public function revoke(string $apiTokenId): JsonResponse
|
||||
public function revoke(Token $apiToken): JsonResponse
|
||||
{
|
||||
$user = $this->user();
|
||||
|
||||
$apiToken = $user->tokens()->where('id', $apiTokenId)->firstOrFail();
|
||||
if ($apiToken->user_id !== $user->getKey()) {
|
||||
throw new AuthorizationException('API token does not belong to user');
|
||||
}
|
||||
|
||||
$apiToken->revoke();
|
||||
|
||||
@@ -77,11 +79,13 @@ class ApiTokenController extends Controller
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*/
|
||||
public function destroy(string $apiTokenId): JsonResponse
|
||||
public function destroy(Token $apiToken): JsonResponse
|
||||
{
|
||||
$user = $this->user();
|
||||
|
||||
$apiToken = $user->tokens()->where('id', $apiTokenId)->firstOrFail();
|
||||
if ($apiToken->user_id !== $user->getKey()) {
|
||||
throw new AuthorizationException('API token does not belong to user');
|
||||
}
|
||||
|
||||
$apiToken->delete();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user