Archived
1
0
Fork 0

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:
Henrik Hautakoski 2018-03-30 09:16:49 +00:00
commit 9d2ce9e3d9
2 changed files with 90 additions and 0 deletions

View 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();
}
}

View file

@ -15,12 +15,18 @@ class User extends Model
protected $username;
protected $name;
protected $email;
protected $status;
protected $password;
protected $github_id;
protected $github_user;
public function initialize()
{
$this->useDynamicUpdate(true);
@ -62,6 +68,24 @@ class User extends Model
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
*/
@ -127,6 +151,42 @@ class User extends Model
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
*