File manager - Edit - /var/www/html/spdc/api/app/Http/Resources/ShelterFamilyResource.php
Back
<?php namespace App\Http\Resources; use Illuminate\Http\Resources\Json\JsonResource; class ShelterFamilyResource extends JsonResource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ public function toArray($request) { if($this->resource === null){ return []; }; // return parent::toArray($request); return [ 'id'=> $this->id, 'name'=> $this->name, 'responsible'=> $this->responsible, 'establishment'=> $this->establishment, 'city'=> $this->city, 'state'=> $this->state, 'number'=> $this->number, 'zip_code'=> $this->zip_code, 'neighborhood'=> $this->neighborhood, 'street'=> $this->street, 'complement' => $this->complement, 'reference_point'=> $this->reference_point, 'longitude'=> $this->longitude, 'latitude'=> $this->latitude, 'observation'=> $this->observation, 'amount'=> $this->amount, 'is_homeless'=> $this->is_homeless, 'is_unsheltered' => $this->is_unsheltered, 'is_sheltered' => $this->is_sheltered, 'gender' => $this->genderString(), 'cpf' => $this->cpf, 'rg' => $this->rg, 'mother_name' => $this->mother_name, 'father_name' => $this->father_name, 'living_time_years' => $this->living_time_years, 'living_time_months' => $this->living_time_months, 'birth_date' => $this->birth_date, 'posto_saude' => $this->posto_saude, 'nis' => $this->nis, 'phone1' => $this->phone1, 'phone2' => $this->phone2, 'naturalization' => $this->naturalization, 'tem_cad_unico' => $this->tem_cad_unico, 'outros' => $this->outros, 'other_benefit' => $this->other_benefit, 'other_housing' => $this->other_housing, 'family_type_id' => $this->family_type_id, 'income' => $this->income, 'home_interdiction' => $this->home_interdiction, 'shelter_id'=> $this->shelter_id, 'created_at'=> $this->created_at, 'updated_at'=> $this->updated_at, 'income_per_person' => $this->income_per_person, 'members' => $this->when( $this->relationLoaded('members') && $this->members !== null, fn() => ShelterMemberFamilyResource::collection($this->members) ), 'pets' => $this->when( $this->relationLoaded('pets') && $this->pets !== null, fn() => ShelterPetsResource::collection($this->pets) ), 'shelter'=> (new ShelterResource($this->shelter)), 'donations'=> DonationQuestionnaireResource::collection($this->whenLoaded('donations')), 'family_health_questionnaires'=> FamilyHealthQuestionnaireResource::collection($this->whenLoaded('familyHealthQuestionnaires')), 'emergency_questionnaire' => EmergencyQuestionnaireResource::collection($this->whenLoaded('emergencyQuestionnaire')), 'benefits' => new BenefitResource($this->whenLoaded('benefit')), 'housing_types' => new HousingTypeResource($this->whenLoaded('housingType')), 'marital_statuses' => new MaritalStatusResource($this->whenLoaded('maritalStatus')), 'family_type' => new FamilyTypeResource($this->whenLoaded('familyType')), 'last_affected' => $this->last_affected, ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings