Commit 4e77187f by 杨树贤

注册新增字段

parent 68bb6237
......@@ -2,9 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="fb90add0-1393-48c2-9f26-72365d42cd03" name="变更" comment="">
<change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Requests/UserRegister.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Requests/UserRegister.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Api/AuthApiController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Api/AuthApiController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/UserModel.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/UserModel.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bootstrap/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bootstrap/cache/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/cache/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/app/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/app/.gitignore" afterDir="false" />
......@@ -188,7 +188,7 @@
<workItem from="1666835076791" duration="693000" />
<workItem from="1667266026118" duration="40321000" />
<workItem from="1667959054458" duration="183000" />
<workItem from="1667986756173" duration="3354000" />
<workItem from="1667986756173" duration="3812000" />
</task>
<servers />
</component>
......
......@@ -31,9 +31,9 @@ class AuthApiController extends Controller
if ($cachedEmailCode != $request->input('email_code')) {
return $this->setError('Email code invalid');
}
$user = UserModel::createUser($request->all());
$userId = UserModel::createUser($request->all());
\Auth::login($user);
\Auth::loginUsingId($userId);
return $this->setSuccess('Register success');
}
......
......@@ -18,11 +18,6 @@ class UserModel extends Authenticatable implements MustVerifyEmail
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
];
public $timestamps = false;
......@@ -47,12 +42,14 @@ class UserModel extends Authenticatable implements MustVerifyEmail
public static function createUser($data)
{
return UserModel::create([
return UserModel::insertGetId([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'email' => $data['email'],
'phone' => $data['phone'],
'email_verified_at' => now(),
'company_name' => $data['company_name'],
'account_properties' => $data['account_properties'],
'password' => Hash::make($data['password']),
]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment