File manager - Edit - /var/www/html/spdc/api/app/Http/Requests/ShelterCommonAreaRequest.php
Back
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Contracts\Validation\Validator; use Illuminate\Http\Exceptions\HttpResponseException; class ShelterCommonAreaRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array<string, mixed> */ public function rules() { $rules = [ 'name' => 'required|string|max:255|min:3', 'type' => 'required|in:AREA COMUM,SALA,ESPAÇO ABERTO,ESPAÇO COBERTO,DISPENSA,REFEITÓRIO', 'length' => 'required|numeric', 'width' => 'required|numeric', 'total_area' => 'required|numeric', 'observation' => 'string|max:255|min:3', ]; if ($this->method() == 'PUT' || $this->method() == 'PATCH') { return $rules; } $rules = [ 'shelter_id' => 'required|exists:shelters,id' ]; return $rules; } public function failedValidation(Validator $validator) { throw new HttpResponseException(response()->json([ 'success' => false, 'message' => 'Validation errors', 'data' => $validator->errors() ])); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings