本文整理汇总了PHP中Illuminate\Auth\Passwords\PasswordBroker::validator方法的典型用法代码示例。如果您正苦于以下问题:PHP PasswordBroker::validator方法的具体用法?PHP PasswordBroker::validator怎么用?PHP PasswordBroker::validator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Auth\Passwords\PasswordBroker
的用法示例。
在下文中一共展示了PasswordBroker::validator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validator
/**
* Set a custom password validator.
*
* @param \Closure $callback
* @return void
* @static
*/
public static function validator($callback)
{
\Illuminate\Auth\Passwords\PasswordBroker::validator($callback);
}
示例2: registerPasswordBroker
/**
* Register the password broker instance.
*
* @return void
*/
protected function registerPasswordBroker()
{
$this->app->singleton('auth.password', function ($app) {
// The password token repository is responsible for storing the email addresses
// and password reset tokens. It will be used to verify the tokens are valid
// for the given e-mail addresses. We will resolve an implementation here.
$tokens = $app['auth.password.tokens'];
$users = $app['auth']->driver()->getProvider();
$view = $app['config']['auth.password.email'];
// The password broker uses a token repository to validate tokens and send user
// password e-mails, as well as validating that password reset process as an
// aggregate service of sorts providing a convenient interface for resets.
$broker = new PasswordBroker($tokens, $users, $app['mailer'], $view);
// register validator for password
$broker->validator(function ($credentials) {
try {
return app('xe.user')->validatePassword($credentials['password']);
} catch (\Exception $e) {
return false;
}
});
return $broker;
});
}