app/models/Data/User.php: adding findFirstByUsernameOrEmail()
This commit is contained in:
parent
ba39333e1a
commit
cf92cfe37a
1 changed files with 14 additions and 0 deletions
|
|
@ -110,4 +110,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