2023-01-15 15:49:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Features;
|
|
|
|
|
2023-01-20 20:55:43 +00:00
|
|
|
use App\Dto\ClubLookupCommand;
|
|
|
|
use App\Http\Resources\V4\ClubResource;
|
2023-01-15 15:49:33 +00:00
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
2023-01-20 20:55:43 +00:00
|
|
|
* @extends ItemLookupHandler<ClubLookupCommand, JsonResponse>
|
2023-01-15 15:49:33 +00:00
|
|
|
*/
|
2023-01-20 20:55:43 +00:00
|
|
|
final class ClubLookupHandler extends ItemLookupHandler
|
2023-01-15 15:49:33 +00:00
|
|
|
{
|
|
|
|
protected function resource(Collection $results): JsonResource
|
|
|
|
{
|
2023-01-20 20:55:43 +00:00
|
|
|
return new ClubResource($results->first());
|
2023-01-15 15:49:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function requestClass(): string
|
|
|
|
{
|
2023-01-20 20:55:43 +00:00
|
|
|
return ClubLookupCommand::class;
|
2023-01-15 15:49:33 +00:00
|
|
|
}
|
|
|
|
}
|