File manager - Edit - /var/www/html/spdc/api/app/Http/Requests/ShelterVoluntaryRequest.php
Back
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Contracts\Validation\Validator; class ShelterVoluntaryRequest 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:5', 'cpf'=>'required|string|max:255|min:5', 'city' => 'required|string|max:255|min:5', 'state' => 'required|string|max:255|min:2', 'number' => 'required|numeric', 'zip_code' => 'required|string', 'neighborhood' => 'required|string|max:255|min:3', 'street' => 'required|string|max:255|min:3', 'specialties' => 'required|string|max:255|min:3', 'observation' => 'string|max:255|min:3', 'phone' => 'required|string|max:17|min:3', ]; if($this->method() == 'PUT' || $this->method() == 'PATCH'){ $rules = [ 'is_active' => 'required|boolean', ]; 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