$persistedChannels 대상 레코드에 이미 저장된 채널 목록 */ public function __construct( private array $persistedChannels = [] ) {} /** * 검증 규칙 실행 * * @param string $attribute 필드명 * @param mixed $value 검증 값 * @param Closure $fail 실패 콜백 */ public function validate(string $attribute, mixed $value, Closure $fail): void { if (! is_string($value) || $value === '') { $fail(__('validation.notification_channel.invalid', ['value' => (string) $value])); return; } if (in_array($value, $this->persistedChannels, true)) { return; } if (! app(NotificationChannelService::class)->isChannelAvailable($value)) { $fail(__('validation.notification_channel.unavailable', ['value' => $value])); } } }