Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CustomPasswordResetServiceProvider | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| registerPasswordBroker | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| register | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Providers; |
| 4 | |
| 5 | use App\Auth\MongoPasswordResetRepository; |
| 6 | use App\Services\CustomPasswordBrokerManager; |
| 7 | use Illuminate\Auth\Passwords\PasswordBrokerManager; |
| 8 | use Illuminate\Auth\Passwords\PasswordResetServiceProvider; |
| 9 | |
| 10 | // use MongoDB\Laravel\Auth\PasswordResetServiceProvider; |
| 11 | |
| 12 | class CustomPasswordResetServiceProvider extends PasswordResetServiceProvider |
| 13 | { |
| 14 | /** |
| 15 | * Register the password broker instance. |
| 16 | */ |
| 17 | protected function registerPasswordBroker(): void |
| 18 | { |
| 19 | $this->app->singleton('auth.password', function ($app) { |
| 20 | return new CustomPasswordBrokerManager($app); |
| 21 | }); |
| 22 | |
| 23 | $this->app->bind('auth.password.broker', function ($app) { |
| 24 | return $app->make('auth.password')->broker(); |
| 25 | }); |
| 26 | } |
| 27 | public function register() |
| 28 | { |
| 29 | $this->app->singleton('auth.password', function ($app) { |
| 30 | return new PasswordBrokerManager($app); |
| 31 | }); |
| 32 | |
| 33 | $this->app->bind('auth.password.broker', function ($app) { |
| 34 | return $app->make('auth.password')->broker(); |
| 35 | }); |
| 36 | |
| 37 | // Registrar o custom repository |
| 38 | $this->app->singleton('auth.password.tokens', function ($app) { |
| 39 | $config = $app['config']['auth.passwords.users'] ?? []; |
| 40 | return new MongoPasswordResetRepository( |
| 41 | $app['hash'], |
| 42 | $app['config']['app.key'], |
| 43 | $config['expire'] ?? 60 |
| 44 | ); |
| 45 | }); |
| 46 | } |
| 47 | } |