/** * @return string Returns the name for the user's login. */ public function getLoginName() { if (static::$loginAttribute !== null) { return static::$loginAttribute; } return static::$loginAttribute = UserSettings::get('login_attribute', UserSettings::LOGIN_EMAIL); }
public function __construct(array $attributes = array()) { // define dependencies // this is for when we are calling the model directly // these are usually defined by the IoC however as we are effectively breaking this to provide a consistent API // so we need to redefine them in the constructor // probably not the best approach... static::$hasher = \App::make('sentry.hasher'); static::$loginAttribute = \Config::get('cartalyst/sentry::users.login_attribute'); parent::__construct($attributes); }
/** * Override the login attribute for all models instances. * * @param string $loginAttribute * @return void */ public static function setLoginAttributeName($loginAttribute) { static::$loginAttribute = $loginAttribute; }