diff --git a/app/models/Data/User.php b/app/models/Data/User.php index 6110b88..c28ac7f 100644 --- a/app/models/Data/User.php +++ b/app/models/Data/User.php @@ -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 ] + ]); + } }