| 1234567891011121314151617181920212223242526 |
- <?php
- namespace App\Http\Controllers;
- use App\Http\Resources\PositionResource;
- use App\Services\PositionService;
- use Illuminate\Http\JsonResponse;
- class PositionController extends Controller
- {
- public function __construct(
- protected PositionService $service,
- ) {}
- public function index(): JsonResponse
- {
- $items = $this->service->getAllItems();
- return $this->successResponse(payload: PositionResource::collection($items));
- }
- public function show(int $id): JsonResponse
- {
- $item = $this->service->getItem($id);
- return $this->successResponse(payload: new PositionResource($item));
- }
- }
|