When working with Laravel's service container, you can use contextual binding to inject different implementations of an interface based on which class is requesting it:
$this->app->when(PhotoController::class)
->needs(StorageInterface::class)
->give(CloudStorage::class);
$this->app->when(DocumentController::class)
->needs(StorageInterface::class)
->give(LocalStorage::class);
This approach allows you to maintain clean dependency injection in your classes while letting the container handle the complexity of determining which implementation to provide. Your controllers can simply type-hint the interface in their constructors, and Laravel will automatically inject the appropriate implementation based on the context.