Merge branch '3-login-with-username' into 'master'
Resolve "Login with username" Closes #3 See merge request pnx/httpcb!3
This commit is contained in:
commit
34f639e964
3 changed files with 24 additions and 9 deletions
|
|
@ -126,4 +126,18 @@ class User extends Model
|
|||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first user by Username or Email
|
||||
*
|
||||
* @param string $value
|
||||
* @return User|bool
|
||||
*/
|
||||
static public function findFirstByUsernameOrEmail($value)
|
||||
{
|
||||
return self::findFirst([
|
||||
"email = :v: OR username = :v:",
|
||||
"bind" => [ 'v' => $value ]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue