| Conditions | 2 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function register(): void |
||
| 14 | { |
||
| 15 | // Register the JWT driver with Laravel |
||
| 16 | $auth = $this->app->make(AuthManager::class); |
||
| 17 | $auth->extend('jwt', function (Application $app, string $name, array $config) use ($auth) { |
||
| 18 | $provider = $auth->createUserProvider($config['provider'] ?? null); |
||
| 19 | |||
| 20 | if ($provider === null) { |
||
| 21 | throw new RuntimeException('No user provider available'); |
||
| 22 | } |
||
| 23 | |||
| 24 | $guard = new JWTGuard($provider, $name, $config); |
||
| 25 | $guard |
||
| 26 | // Set the request instance on the guard |
||
| 27 | ->setRequest($app->refresh('request', $guard, 'setRequest')) |
||
| 28 | // Set the event dispatcher on the guard |
||
| 29 | ->setDispatcher($this->app['events']) |
||
| 30 | // Set the cookie jar |
||
| 31 | ->setCookieJar($this->app['cookie']); |
||
| 32 | |||
| 33 | return $guard; |
||
| 34 | }); |
||
| 35 | |||
| 36 | $this->commands([ |
||
| 37 | KeyGenerateCommand::class, |
||
| 38 | ]); |
||
| 40 | } |