From daa5e6261f0ca329397fc2a94fe46e0f22474c41 Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Wed, 17 Feb 2021 15:24:31 +0100 Subject: [PATCH] - Fix customers infos --- .../Controllers/Api/v1/CustomerController.php | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Api/v1/CustomerController.php b/app/Http/Controllers/Api/v1/CustomerController.php index 28ae3c6..e544852 100644 --- a/app/Http/Controllers/Api/v1/CustomerController.php +++ b/app/Http/Controllers/Api/v1/CustomerController.php @@ -198,6 +198,7 @@ class CustomerController extends Controller if ($login) { if (Hash::check($password, $login->password)) { if ($login->status === 0) { + $infos = $customer->infos()->where('brand_id', $brandId)->first(); // "Le compte de l'utilisateur n'est pas activé" return new StatusResource( [ @@ -206,17 +207,17 @@ class CustomerController extends Controller 'message' => 'Account not activated.', 'user' => [ 'crm_id' => $customer->id, - 'firstname' => $customer->infos()->firstname, - 'lastname' => $customer->infos()->lastname, - 'birth_date' => $customer->infos()->birth_date, - 'address' => $customer->infos()->address, - 'address2' => $customer->infos()->address2, - 'phone' => $customer->infos()->phone, - 'country' => $customer->infos()->country, - 'city' => $customer->infos()->city, - 'postcode' => $customer->infos()->postcode, - 'opt_in' => $customer->infos()->opt_in, - 'hashcode' => $customer->infos()->hashcode, + 'firstname' => $infos->firstname, + 'lastname' => $infos->lastname, + 'birth_date' => $infos->birth_date, + 'address' => $infos->address, + 'address2' => $infos->address2, + 'phone' => $infos->phone, + 'country' => $infos->country, + 'city' => $infos->city, + 'postcode' => $infos->postcode, + 'opt_in' => $infos->opt_in, + 'hashcode' => $infos->hashcode, 'status' => $login->status, ] ]);