Merge branch '8-add-more-user-fields' into 'master'
Resolve "Add more user fields." Closes #8 See merge request pnx/httpcb!7
This commit is contained in:
commit
9d2ce9e3d9
2 changed files with 90 additions and 0 deletions
30
app/migrations/20180330090144_user_fields.php
Normal file
30
app/migrations/20180330090144_user_fields.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
class UserFields extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Add regdate column
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->table('user')
|
||||||
|
->addColumn('name', 'string', [
|
||||||
|
'limit' => 128,
|
||||||
|
'null' => true,
|
||||||
|
'after' => 'username'
|
||||||
|
])
|
||||||
|
->addColumn('github_id', 'integer', [
|
||||||
|
'limit' => 14,
|
||||||
|
'null' => true,
|
||||||
|
'after' => 'password'
|
||||||
|
])
|
||||||
|
->addColumn('github_user', 'string', [
|
||||||
|
'limit' => 80,
|
||||||
|
'null' => true,
|
||||||
|
'after' => 'github_id'
|
||||||
|
])->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,12 +15,18 @@ class User extends Model
|
||||||
|
|
||||||
protected $username;
|
protected $username;
|
||||||
|
|
||||||
|
protected $name;
|
||||||
|
|
||||||
protected $email;
|
protected $email;
|
||||||
|
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
protected $password;
|
protected $password;
|
||||||
|
|
||||||
|
protected $github_id;
|
||||||
|
|
||||||
|
protected $github_user;
|
||||||
|
|
||||||
public function initialize()
|
public function initialize()
|
||||||
{
|
{
|
||||||
$this->useDynamicUpdate(true);
|
$this->useDynamicUpdate(true);
|
||||||
|
|
@ -62,6 +68,24 @@ class User extends Model
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $name
|
||||||
|
* @return User
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
|
@ -127,6 +151,42 @@ class User extends Model
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getGithubUser()
|
||||||
|
{
|
||||||
|
return $this->github_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $github_user
|
||||||
|
* @return User
|
||||||
|
*/
|
||||||
|
public function setGithubUser($github_user)
|
||||||
|
{
|
||||||
|
$this->github_user = $github_user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getGithubId()
|
||||||
|
{
|
||||||
|
return $this->github_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $github_id
|
||||||
|
* @return User
|
||||||
|
*/
|
||||||
|
public function setGithubId($github_id)
|
||||||
|
{
|
||||||
|
$this->github_id = $github_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the first user by Username or Email
|
* Find the first user by Username or Email
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Reference in a new issue