|
|
|
@ -114,12 +114,18 @@ class AuthApiController extends BaseAuthApiController |
|
|
|
|
$dataInsert = $this->transformRegisterData($request->all()); |
|
|
|
|
|
|
|
|
|
if (!empty($dataInsert)) { |
|
|
|
|
if (!empty($checkUserAgent->agent_id)) { |
|
|
|
|
$agentParent = Agent::find($checkUserAgent->agent_id); |
|
|
|
|
$grantParent = $agentParent->grant; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$userId = \App\Models\User::insertGetId($dataInsert); |
|
|
|
|
if ($userId) { |
|
|
|
|
$dataAgentInsert = [ |
|
|
|
|
'name' => $dataInsert['name'] ?? '', |
|
|
|
|
'type' => self::AGENTS, |
|
|
|
|
'grant' => $this->_default_grant_two, |
|
|
|
|
// 'grant' => $this->_default_grant_two, |
|
|
|
|
'grant' => !empty($grantParent)?$grantParent+1:1, |
|
|
|
|
'phone' => $dataInsert['phone'] ?? '', |
|
|
|
|
'address' => $dataInsert['address'] ?? '', |
|
|
|
|
]; |
|
|
|
|