Edit File: UserResource.php
<?php namespace App\Http\Resources\Api; use Illuminate\Http\Resources\Json\JsonResource; class UserResource extends JsonResource { private $token = ''; public function setToken($value) { $this->token = $value; return $this; } public function toArray($request) { return [ 'id' => $this->id, 'image' => $this->image, 'cover' => $this->cover, 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'full_name' => $this->full_name, 'phone' => $this->phone, 'country_code' => $this->country_code, 'full_phone' => $this->full_phone, 'email' => $this->email, 'birth_date' => $this->birth_date, 'gender' => $this->gender, 'gender_text' => $this->gender_text, 'city' => $this->city ? [ 'id' => $this->city_id, 'name' => $this->city?->name ] : null, 'country' => $this->country ? [ 'id' => $this->country_id, 'name' => $this->country?->name ] : null, 'bio' => $this->bio, 'lat' => $this->lat, 'lng' => $this->lng, 'map_desc' => $this->map_desc, 'is_blocked' => (bool) $this->is_blocked, 'is_notify' => (bool) $this->is_notify, 'is_active' => (bool) $this->is_active, 'is_subscribed' => (bool) $this->hasSubscription(), 'is_profile_completed' => (bool) $this->isCompleted(), 'is_interests_completed' => (bool) $this->isInterestsCompleted(), 'has_used_free_trial' => $this->hasUsedFreeTrial(), 'interests' => $this->groupedInterests(), 'token' => request()->header('authorization') ?? $this->token, ]; } }
Back to File Manager