File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/GeologicHazardLayerController.php
Back
<?php namespace App\Http\Controllers; use App\Http\Services\GeologicHazardLayerService; use App\Models\GeologicHazardLayer; use App\Http\Requests\GeologicHazardLayerRequest; use App\Http\Requests\GeologicHazardLayerUpdateRequest; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; class GeologicHazardLayerController extends Controller { private GeologicHazardLayerService $service; public function __construct() { $this->service = new GeologicHazardLayerService(); $this->middleware('auth.permissions:gestao-de-camadas'); } /** * @OA\Get( * path="/api/geologic-hazard-layer", * summary="Lista todos os camadas geológicas", * operationId="GetAllGeologicHazardLayers", * security={{"bearerAuth":{}}}, * tags={"Geologic Hazard Layers"}, * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ) * ) */ public function index(): JsonResponse { $response = $this->service->index(); return response()->json($response->data, $response->code); } /** * @OA\Post( * path="/api/geologic-hazard-layer", * summary="Adiciona uma nova camada geológica", * operationId="AddNewGeologicHazardLayer", * security={{"bearerAuth":{}}}, * tags={"Geologic Hazard Layers"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"name", "file"}, * @OA\Property( * property="name", * type="string", * example="Camada de risco geológico 1", * description="Nome da camada" * ), * @OA\Property( * property="file", * type="string", * ), * ) * ) * ), * @OA\Response( * response="201", * description="Created", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success.") * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Unauthorized.") * ) * ), * @OA\Response( * response="400", * description="Bad request", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Bad request") * ) * ) * ) */ public function store(GeologicHazardLayerRequest $request): JsonResponse { $response = $this->service->store($request); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/geologic-hazard-layer/{id}", * summary="Mostra a camada de risco geológico", * operationId="ShowGeologicHazardLayer", * security={{"bearerAuth":{}}}, * tags={"Geologic Hazard Layers"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID da camada de risco geológico", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Geologic Hazard Layer not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Geologic Hazard Layer not found") * ) * ) * ) */ public function show(string $id): JsonResponse { $response = $this->service->show($id); return response()->json($response->data, $response->code); } /** * @OA\Put( * path="/api/geologic-hazard-layer/{id}", * summary="Atualiza a camada de risco geológico", * operationId="UpdateGeologicHazardLayer", * security={{"bearerAuth":{}}}, * tags={"Geologic Hazard Layers"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID da camada de risco geológico", * @OA\Schema(type="string") * ), * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * @OA\Property( * property="name", * type="string", * example="Camada de risco geológico 1", * description="Nome da camada" * ), * @OA\Property( * property="file", * type="string", * ), * ) * ) * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success.") * ) * ), * @OA\Response( * response="404", * description="Geologic Hazard Layer not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Geologic Hazard Layer not found") * ) * ) * ) */ public function update(GeologicHazardLayerUpdateRequest $request, string $id): JsonResponse { $response = $this->service->update($request, $id); return response()->json($response->data, $response->code); } /** * @OA\Delete( * path="/api/geologic-hazard-layer/{id}", * summary="Exclui a camada de risco geológico", * operationId="DeleteGeologicHazardLayer", * security={{"bearerAuth":{}}}, * tags={"Geologic Hazard Layers"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID da camada de risco geológico", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Geologic Hazard Layer not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Geologic Hazard Layer not found") * ) * ) * ) */ public function destroy(string $id): JsonResponse { $response = $this->service->destroy($id); return response()->json($response->data, $response->code); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings