misc_pterodactyl-panel/app/Http/Controllers/Api/Application/Users/ExternalUserController.php

24 lines
772 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Http\Controllers\Api\Application\Users;
use Pterodactyl\Models\User;
use Pterodactyl\Transformers\Api\Application\UserTransformer;
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
use Pterodactyl\Http\Requests\Api\Application\Users\GetExternalUserRequest;
class ExternalUserController extends ApplicationApiController
{
/**
* Retrieve a specific user from the database using their external ID.
*/
public function index(GetExternalUserRequest $request, string $external_id): array
{
$user = User::query()->where('external_id', $external_id)->firstOrFail();
return $this->fractal->item($user)
2022-12-15 00:05:46 +00:00
->transformWith(UserTransformer::class)
->toArray();
}
}