Changeset View
Changeset View
Standalone View
Standalone View
src/app/Traits/EmailPropertyTrait.php
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | trait EmailPropertyTrait | ||||
} | } | ||||
/** | /** | ||||
* Find whether an email address exists as a model object (including soft-deleted). | * Find whether an email address exists as a model object (including soft-deleted). | ||||
* | * | ||||
* @param string $email Email address | * @param string $email Email address | ||||
* @param bool $return_object Return model instance instead of a boolean | * @param bool $return_object Return model instance instead of a boolean | ||||
* | * | ||||
* @return object|bool True or Model object if found, False otherwise | * @return static|bool True or Model object if found, False otherwise | ||||
*/ | */ | ||||
public static function emailExists(string $email, bool $return_object = false) | public static function emailExists(string $email, bool $return_object = false) | ||||
{ | { | ||||
if (strpos($email, '@') === false) { | if (strpos($email, '@') === false) { | ||||
return false; | return false; | ||||
} | } | ||||
$email = \strtolower($email); | $email = \strtolower($email); | ||||
Show All 20 Lines |