Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Allows to customize broadcast channel name for broadcasting notification channel #16018

Merged
merged 1 commit into from
Oct 22, 2016

Conversation

kduma
Copy link
Contributor

@kduma kduma commented Oct 20, 2016

Allows to customize broadcast channel name for broadcasting notification channel.

To set channel name, place this method in your notifiable class:

    public function broadcastNotificationChannelName($notification)
    {
        return 'notifications.'.$this->id;
    }

I've made this PR because I wanted to get rid of long channel name like App.Models.Users.User.*, and hide class structures from an end user. It would be also great if anyone would like to encrypt user id using something like HashIds:

    public function broadcastNotificationChannelName($notification)
    {
        return 'App.User.' . Hashids::encrypt($this->id);
    }

@kduma kduma changed the title [5.3] Allow possibility to overwrite channel name for broadcast notification [5.3] Allows to customize broadcast channel name for broadcasting notification channel Oct 20, 2016
@taylorotwell taylorotwell merged commit 2407eee into laravel:5.3 Oct 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants