brandId = $brandId; } /** * Transform the resource into an array. * * @param mixed $request * @return array */ //phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass, Squiz.Commenting.FunctionComment.Missing public function toArray($request) { $infos = $this->infos()->where('brand_id', $this->brandId)->first(); $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, ] ]; } }