From de29c911b14ef68d5353e823fa33b70c75759b31 Mon Sep 17 00:00:00 2001 From: Hamees Ahmed Khan <32523517+hameesakhan@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:38:30 +0500 Subject: [PATCH] Prevent overridding Laravel's Notifiable method Protecting Laravel's Notifiable method `routeNotificationFor` will leave channel names to their default behaviour and will not affect `mail` and `database` notifications. Otherwsie, the recommended function will cause error for those two notification drivers. --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 13d6c84..b7234fb 100644 --- a/README.md +++ b/README.md @@ -135,15 +135,9 @@ however you can change this behaviour by including a `routeNotificationFor()` in I.e. if you are pushing notification on ``User`` model, you can go to `App\User` class and implement method: ``` -public function routeNotificationFor($channel) +public function routeNotificationForPusherPushNotifications($notification) { - if($channel === 'PusherPushNotifications'){ - return 'your.custom.interest.string'; - } - - $class = str_replace('\\', '.', get_class($this)); - - return $class.'.'.$this->getKey(); + return 'your.custom.interest.string'; } ```