Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| CustomPasswordBrokerManager | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| resolve | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Services; |
| 4 | |
| 5 | use InvalidArgumentException; |
| 6 | use MongoDB\Laravel\Auth\PasswordBrokerManager; |
| 7 | |
| 8 | class CustomPasswordBrokerManager extends PasswordBrokerManager |
| 9 | { |
| 10 | /** |
| 11 | * Resolve the given broker. |
| 12 | * |
| 13 | * @param string $name |
| 14 | * @return \Illuminate\Contracts\Auth\PasswordBroker |
| 15 | * |
| 16 | * @throws \InvalidArgumentException |
| 17 | */ |
| 18 | protected function resolve($name) |
| 19 | { |
| 20 | $config = $this->getConfig($name); |
| 21 | |
| 22 | if (is_null($config)) { |
| 23 | throw new InvalidArgumentException("Password resetter [{$name}] is not defined."); |
| 24 | } |
| 25 | |
| 26 | // The password broker uses a token repository to validate tokens and send user |
| 27 | // password e-mails, as well as validating that password reset process as an |
| 28 | // aggregate service of sorts providing a convenient interface for resets. |
| 29 | return new CustomPasswordBroker( |
| 30 | $this->createTokenRepository($config), |
| 31 | $this->app['auth']->createUserProvider($config['provider'] ?? null) |
| 32 | ); |
| 33 | } |
| 34 | } |