2018-02-08 03:56:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Api\Application\Users;
|
|
|
|
|
2022-05-22 18:10:01 +00:00
|
|
|
use Pterodactyl\Models\User;
|
2018-02-08 03:56:11 +00:00
|
|
|
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.
|
|
|
|
*/
|
2022-05-22 18:10:01 +00:00
|
|
|
public function index(GetExternalUserRequest $request, string $external_id): array
|
2018-02-08 03:56:11 +00:00
|
|
|
{
|
2022-05-22 18:10:01 +00:00
|
|
|
$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)
|
2018-02-08 03:56:11 +00:00
|
|
|
->toArray();
|
|
|
|
}
|
|
|
|
}
|