Also: test uses disabled channels instead of deleting them (FK cascade); ChannelRegistry no longer final so tests can extend it (controller ruling). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
21 lines
562 B
PHP
21 lines
562 B
PHP
<?php
|
|
|
|
namespace App\Channels;
|
|
|
|
use App\Enums\ChannelType;
|
|
use Illuminate\Contracts\Container\Container;
|
|
|
|
class ChannelRegistry
|
|
{
|
|
public function __construct(private readonly Container $container) {}
|
|
|
|
public function for(ChannelType $type): ChannelDriver
|
|
{
|
|
return match ($type) {
|
|
ChannelType::Web => $this->container->make(WebChannel::class),
|
|
ChannelType::Webhook => $this->container->make(WebhookChannel::class),
|
|
ChannelType::Telegram => $this->container->make(TelegramChannel::class),
|
|
};
|
|
}
|
|
}
|