brandId = $brandId; } /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function toArray(Request $request): array { //phpcs:disable /** @var \App\Models\CustomerInfo */ $infos = $this->infos()->where('brand_id', $this->brandId)->first(); /** @var \App\Models\CustomerLogin */ $login = $this->logins()->where('brand_id', $this->brandId)->first(); return [ 'status' => 'OK', 'user' => [ 'crm_id' => $this->id, 'firstname' => $infos->firstname, 'lastname' => $infos->lastname, 'email' => $this->email, 'birth_date' => $infos->birth_date, 'address' => $infos->address, 'address2' => $infos->address2, 'phone' => $infos->phone, 'country' => $infos->country->label(), 'city' => $infos->city, 'postcode' => $infos->postcode, 'opt_in' => $infos->opt_in, 'hashcode' => $infos->hashcode, 'status' => $login->status, ] ]; } }