diff --git a/catch/user/controller/User.php b/catch/user/controller/User.php index cce6654..a7904ba 100644 --- a/catch/user/controller/User.php +++ b/catch/user/controller/User.php @@ -1,10 +1,9 @@ user->storeBy($request->post()); - + $this->user->attach($request->param('roles')); return CatchResponse::success('', '添加成功'); diff --git a/catch/user/database/migrations/20191128114204_users.php b/catch/user/database/migrations/20191128114204_users.php index 463aa06..9c7aa3b 100644 --- a/catch/user/database/migrations/20191128114204_users.php +++ b/catch/user/database/migrations/20191128114204_users.php @@ -32,6 +32,7 @@ class Users extends Migrator $table->addColumn('username', 'string',array('limit' => 15,'default'=>'','comment'=>'用户名')) ->addColumn('password', 'string',array('limit' => 255,'comment'=>'用户密码')) ->addColumn('email', 'string',array('limit' => 100, 'comment'=>'邮箱 登录')) + ->addColumn('creator_id', 'integer',['default' => 0, 'comment'=>'创建人ID']) ->addColumn('status', 'boolean',array('limit' => 1,'default'=> 1,'comment'=>'用户状态 1 正常 2 禁用')) ->addColumn('last_login_ip', 'string',array('limit' => 30,'default'=>0,'comment'=>'最后登录IP')) ->addColumn('last_login_time', 'integer',array('default'=>0,'comment'=>'最后登录时间', 'signed' => false)) diff --git a/catch/user/model/Users.php b/catch/user/model/Users.php index ef81a7c..be4549e 100644 --- a/catch/user/model/Users.php +++ b/catch/user/model/Users.php @@ -15,6 +15,7 @@ class Users extends CatchModel 'username', // 用户名 'password', // 用户密码 'email', // 邮箱 登录 + 'creator_id', 'status', // 用户状态 1 正常 2 禁用 'last_login_ip', // 最后登录IP 'last_login_time', // 最后登录时间