Skip to content
Discussion options

You must be logged in to vote

Yes, I wanted only to make sure it is not available. Thank you for the clarification.

I'm attaching here my current solution. (not perfect, but works :) its purpose) can sanitize more channels than just slack if you add the options to canSend() method

final class NotificationChannelsService
{
    /**
     * @param  array<string>  $via
     * @return array<string>
     */
    public function sanitizeChannels(array $via): array
    {
        return array_filter($via, fn (string $channel) => $this->canSend($channel));
    }

    private function canSend(string $channel): bool
    {
        return match ($channel) {
            'slack' => $this->shouldSendToSlack(),
            default => tru…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by abdel-aouby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants