File manager - Edit - /var/www/html/spdc/api/app/Http/Services/BenefitService.php
Back
<?php namespace App\Http\Services; use App\Classes\BaseServiceResponse; use App\Http\Resources\BenefitResource; use App\Models\Benefit; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; class BenefitService extends BaseService { public function index(): BaseServiceResponse { return $this->response( BenefitResource::collection(Benefit::all()), JsonResponse::HTTP_OK ); } public function store(Request $request): BaseServiceResponse { $benefit = Benefit::create($request->all()); return $this->response( new BenefitResource($benefit), JsonResponse::HTTP_CREATED ); } public function show(string $id): BaseServiceResponse { $benefit = Benefit::findOrFail(['id' => $id])->first(); return $this->response( new BenefitResource($benefit), JsonResponse::HTTP_OK ); } public function update(Request $request, string $id): BaseServiceResponse { $benefit = Benefit::findOrFail(['id' => $id])->first(); $benefit->update($request->all()); return $this->response( new BenefitResource($benefit), JsonResponse::HTTP_OK ); } public function destroy(string $id): BaseServiceResponse { $benefit = Benefit::findOrFail(['id' => $id])->first(); $benefit->delete(); return $this->response( null, JsonResponse::HTTP_NO_CONTENT ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings