/**
* Ensure the current user can access authenticated API routes, either via existing session
* authentication or via API Token authentication.
+ *
* @throws UnauthorizedException
*/
protected function ensureAuthorizedBySessionOrToken(): void
if (!user()->can('access-api')) {
throw new ApiAuthException(trans('errors.api_user_no_api_permission'), 403);
}
+
return;
}
{
return response()->json([
'error' => [
- 'code' => $code,
+ 'code' => $code,
'message' => $message,
- ]
+ ],
], $code);
}
}