Archived
1
0
Fork 0

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:
Henrik Hautakoski 2018-03-21 19:55:57 +00:00
commit 34f639e964
3 changed files with 24 additions and 9 deletions

View file

@ -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 ]
]);
}
}