File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/OccurrencyInspectionController.php
Back
<?php namespace App\Http\Controllers; use App\Enums\OccurrencySection; use App\Models\Occurrency; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use App\Http\Requests\OccurrencyInspectionRequest; use App\Http\Services\OccurrencyInspectionService; class OccurrencyInspectionController extends Controller { private OccurrencyInspectionService $inpectionService; public function __construct() { $this->inpectionService = new OccurrencyInspectionService(); $this->middleware('auth.permissions:gestao-de-ocorrencias'); } /** * @OA\Post( * path="/api/occurrency/{occurrency_id}/inspection", * summary="Save occurrency inspection info", * description="Save occurrency inspection info", * operationId="SaveOccurrencyInspection", * security={{"bearerAuth":{}}}, * tags={"occurrencys"}, * @OA\Parameter( * name="occurrency_id", * in="path", * required=true, * description="Occurrency ID", * @OA\Schema(type="string") * ), * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/x-www-form-urlencoded", * @OA\Schema( * @OA\Property( * property="forms", * type="array", * description="Array with info forms info", * collectionFormat="multi", * @OA\Items( * @OA\Property( * property="id", * type="string", * ), * @OA\Property( * property="fields", * type="array", * @OA\Items( * @OA\Property(property="id", type="string"), * @OA\Property(property="value", type="string"), * ), * ), * ), * ), * ), * ), * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * @OA\Property( * property="forms", * type="array", * description="Array with info forms info", * collectionFormat="multi", * @OA\Items( * @OA\Property( * property="id", * type="string", * ), * @OA\Property( * property="fields", * type="array", * @OA\Items( * @OA\Property(property="id", type="string"), * @OA\Property(property="value", type="string"), * ), * ), * ), * ), * ), * ), * ), * @OA\Response( * response="204", * description="No content", * @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="422", * description="Validation Error", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Validation Error."), * @OA\Property(property="errors", type="json", example="{}"), * ) * ), * ) */ public function saveInspection(OccurrencyInspectionRequest $request, Occurrency $occurrency): JsonResponse { return $this->response($this->inpectionService->save($request->all(), $occurrency, OccurrencySection::VISTORIA->value)); } public function saveExecution(OccurrencyInspectionRequest $request, Occurrency $occurrency): JsonResponse { return $this->response($this->inpectionService->save($request->all(), $occurrency, OccurrencySection::EXECUÇÃO->value)); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings