From f9b499ae1aa25e78a4aaab49902a217740c864a2 Mon Sep 17 00:00:00 2001 From: nocode Date: Wed, 10 Jul 2024 16:41:18 +0700 Subject: [PATCH] UPDATE API REGISTER --- app/Http/Controllers/Api/AuthApiController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Api/AuthApiController.php b/app/Http/Controllers/Api/AuthApiController.php index 9a4d333..2624fa0 100755 --- a/app/Http/Controllers/Api/AuthApiController.php +++ b/app/Http/Controllers/Api/AuthApiController.php @@ -97,25 +97,26 @@ class AuthApiController extends BaseAuthApiController } $dataInsert = $this->transformRegisterData($request->all()); - + if (!empty($dataInsert)) { $userId = \App\Models\User::insertGetId($dataInsert); if ($userId) { $dataAgentInsert = [ - 'name' => $dataInsert['name']??'', + 'name' => $dataInsert['name'] ?? '', 'type' => self::AGENTS, 'grant' => $this->_default_grant_two ]; $agentInsertId = Agent::insertGetId($dataAgentInsert); - if($agentInsertId){ + if ($agentInsertId) { AgentUser::insert([ - 'user_id' => $userId, - 'agent_id' => $agentInsertId, - 'status' => 1, + 'user_id' => $userId, + 'agent_id' => $agentInsertId, + 'status' => 1, 'code' => $dataInsert['phone'], 'agent_root_id' => $checkUserAgent->agent_root_id ]); - }; + } + ; } return response()->json(['status' => true, 'msg' => $this->getMessageReponse(1)]); }