for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Pan\User;
use Anax\DatabaseActiveRecord\ActiveRecordModel;
/**
* A database driven model using the Active Record design pattern.
*/
class User extends ActiveRecordModel
{
* @var string $tableName name of the database table.
protected $tableName = "users";
* Columns in the table.
*
* @var integer $id primary key auto incremented.
public $id;
public $username;
public $firstname;
public $lastname;
public $password;
public $email;
public $type;
public $points;
public $created;
public $deleted;
* Set the password.
* @param string $password the password to use.
* @return void
public function setPassword($password)
$this->password = password_hash($password, PASSWORD_DEFAULT);
}
* Verify the acronym and the password, if successful the object contains
* all details from the database row.
* @param string $acronym acronym to check.
* @return boolean true if acronym and password matches, else false.
public function verifyPassword($acronym, $password)
$this->find("username", $acronym);
return password_verify($password, $this->password);