Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
12 / 12 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| SanctumRefreshServiceProvider | |
100.00% |
12 / 12 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| configurePackage | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| register | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| boot | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Albet\SanctumRefresh; |
| 4 | |
| 5 | use Albet\SanctumRefresh\Commands\PruneToken; |
| 6 | use Albet\SanctumRefresh\Repositories\RefreshTokenRepository; |
| 7 | use Spatie\LaravelPackageTools\Package; |
| 8 | use Spatie\LaravelPackageTools\PackageServiceProvider; |
| 9 | |
| 10 | class SanctumRefreshServiceProvider extends PackageServiceProvider |
| 11 | { |
| 12 | public function configurePackage(Package $package): void |
| 13 | { |
| 14 | /* |
| 15 | * This class is a Package Service Provider |
| 16 | * |
| 17 | * More info: https://github.com/spatie/laravel-package-tools |
| 18 | */ |
| 19 | $package |
| 20 | ->name('sanctum-refresh') |
| 21 | ->hasConfigFile() |
| 22 | ->hasMigration('create_refresh_tokens_table') |
| 23 | ->hasCommand(PruneToken::class); |
| 24 | } |
| 25 | |
| 26 | public function register() |
| 27 | { |
| 28 | parent::register(); |
| 29 | |
| 30 | $this->app->singleton( |
| 31 | RefreshTokenRepository::class, |
| 32 | fn ($app) => new RefreshTokenRepository() |
| 33 | ); |
| 34 | } |
| 35 | |
| 36 | public function boot() |
| 37 | { |
| 38 | parent::boot(); |
| 39 | |
| 40 | SanctumRefresh::boot(); |
| 41 | } |
| 42 | } |