AppServiceProvider binds Clock -> SystemClock, TokenGenerator -> RandomTokenGenerator, PasswordHasher -> BcryptPasswordHasher. new RepositoryServiceProvider binds UserRepository -> EloquentUserRepository, SessionRepository -> EloquentSessionRepository. bootstrap/providers.php registers both. verified container resolves: app(Clock::class) returns SystemClock. migrations create users + sessions tables with proper unique/foreign-key/index constraints (sqlite roundtrip confirmed).
26 lines
623 B
PHP
26 lines
623 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Auth\BcryptPasswordHasher;
|
|
use App\Auth\Clock;
|
|
use App\Auth\PasswordHasher;
|
|
use App\Auth\RandomTokenGenerator;
|
|
use App\Auth\SystemClock;
|
|
use App\Auth\TokenGenerator;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->bind(Clock::class, SystemClock::class);
|
|
$this->app->bind(TokenGenerator::class, RandomTokenGenerator::class);
|
|
$this->app->bind(PasswordHasher::class, BcryptPasswordHasher::class);
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
//
|
|
}
|
|
}
|