|
|
|
@ -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)]); |
|
|
|
|
} |
|
|
|
|