File manager - Edit - /var/www/html/spdc/api/app/Http/Requests/ShelterFamilyRequest.php
Back
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Contracts\Validation\Validator; use Illuminate\Validation\Rule; class ShelterFamilyRequest 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() { if ($this->method() == 'PUT' || $this->method() == 'PATCH') { return [ 'establishment' => 'string|max:255|min:3', 'city' => 'string|max:255|min:3', 'state' => 'string|max:255|min:2', 'number' => 'numeric', 'zip_code' => 'string|max:255|min:2', 'neighborhood' => 'string|max:255|min:2', 'street' => 'string|max:255|min:2', 'reference_point' => 'string|max:255|min:2', 'longitude' => 'string|max:255|min:2', 'latitude' => 'string|max:255|min:2', 'observation' => 'string|max:255|min:2', 'observation' => 'string|max:255|min:5', 'shelter_id' => 'nullable|exists:shelters,id', 'is_homeless' => 'required|boolean', 'name' => 'required|string|max:255|min:3', 'responsible' => 'required|string|max:255|min:3', 'is_unsheltered' => 'nullable|boolean', 'is_sheltered' => 'nullable|boolean', ]; } $rules = [ 'establishment' => 'string|max:255|min:3', 'city' => 'string|max:255|min:3', 'state' => 'string|max:255|min:2', 'number' => 'numeric', 'zip_code' => 'string|max:255|min:2', 'neighborhood' => 'string|max:255|min:2', 'street' => 'string|max:255|min:2', 'reference_point' => 'string|max:255|min:2', 'longitude' => 'string|max:255|min:2', 'latitude' => 'string|max:255|min:2', 'observation' => 'string|max:255|min:2', 'members' => 'array', 'members.*.id' => 'nullable|string|exists:members,id', 'members.*.name' => 'required_with:members|string|max:255|min:3', 'members.*.age' => 'required_with:members|numeric', 'members.*.document' => 'required_with:members|string|max:255|min:3', 'members.*.is_special_need' => 'required_with:members|boolean', 'members.*.special_need' => ['string','max:255', 'min:3', 'required_if_accepted:members.*.is_special_need'], 'members.*.is_sheltered' => 'required_with:members|boolean', 'members.*.parental_relation' => 'required_with:members|string|max:255|min:3', 'members.*.birth_date' => 'required_with:members|date', 'members.*.gender' => 'required_with:members|string|min:1', 'members.*.ethnicity' => 'required_with:members|string|max:255|min:3', 'members.*.mother_name' => 'required_with:members|string|max:255|min:3', 'members.*.nis' => 'nullable|string|max:255|min:3', 'members.*.country' => 'nullable|string|max:255|min:3', 'members.*.city' => 'nullable|string|max:255|min:3', 'members.*.uf' => 'nullable|string|max:255|min:2', 'members.*.education' => 'nullable|string|max:255|min:3', 'members.*.occupation' => 'nullable|string|max:255|min:3', 'members.*.phone' => 'nullable|string|max:255|min:3', 'members.*.income' => 'nullable|numeric', 'members.*.form_nursing_home' => 'nullable|boolean', 'pets' => 'array', 'pets.*.id' => 'nullable|string|exists:family_pets,id', 'pets.*.name' => 'required_with:pets|string|max:255|min:3', 'pets.*.breed' => 'required_with:pets|string|max:255|min:3', 'pets.*.is_sheltered' => 'required_with:pets|boolean', 'observation' => 'string|max:255|min:5', 'shelter_id' => 'nullable|exists:shelters,id', 'is_homeless' => 'required|boolean', 'name' => 'required|string|max:255|min:3', 'responsible' => 'required|string|max:255|min:3', 'amount' => 'required|numeric', 'marital_status_id' => 'required|exists:marital_statuses,id', 'housing_type_id' => 'required|exists:housing_types,id', 'benefit_id' => 'nullable|exists:benefits,id', 'cpf' => 'required|string|max:255|min:3', 'rg' => 'required|string|max:255|min:3', 'mother_name' => 'required|string|max:255|min:3', 'father_name' => 'required|string|max:255|min:3', 'living_time_years' => 'nullable|numeric', 'living_time_months' => 'nullable|numeric', 'birth_date' => 'required|date', 'posto_saude' => 'nullable|string|max:255|min:3', 'gender' => 'required|string|max:1|regex:/^[MF]$/|min:1', 'nis' => 'required|string|max:255|min:3', 'phone1' => 'required|string|max:255|min:3', 'phone2' => 'nullable|string|max:255|min:3', 'naturalization' => 'nullable|string|max:255|min:3', 'tem_cad_unico' => 'nullable|boolean', 'outros' => 'nullable|string|max:255|min:3', 'other_benefit' => 'nullable|string|max:255|min:3', 'other_housing' => 'nullable|string|max:255|min:3', 'family_type_id' => 'nullable|exists:family_types,id', 'income' => 'nullable|numeric', 'home_interdiction' => 'nullable|boolean', 'is_sheltered' => 'nullable|boolean' ]; return $rules; } public function messages() { return [ 'members.*.special_need.required_if_accepted' => 'O campo Special Need é obrigatório se o campo is_special_need estiver marcado como true', ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings