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).
24 lines
557 B
PHP
24 lines
557 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Auth\EloquentSessionRepository;
|
|
use App\Auth\SessionRepository;
|
|
use App\User\EloquentUserRepository;
|
|
use App\User\UserRepository;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class RepositoryServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->bind(
|
|
UserRepository::class,
|
|
EloquentUserRepository::class,
|
|
);
|
|
$this->app->bind(
|
|
SessionRepository::class,
|
|
EloquentSessionRepository::class,
|
|
);
|
|
}
|
|
}
|