@@ -64,17 +64,19 @@ public function broadcastOn()
64
64
}
65
65
66
66
/**
67
- * Get the type of the broadcasted event.
67
+ * Get the broadcast channel name for the event.
68
68
*
69
69
* @return string
70
70
*/
71
- public function broadcastAs ()
71
+ protected function channelName ()
72
72
{
73
- if (method_exists ($ this ->notification , 'broadcastAs ' )) {
74
- return $ this ->notification -> broadcastAs ( );
73
+ if (method_exists ($ this ->notifiable , 'receivesBroadcastNotificationsOn ' )) {
74
+ return $ this ->notifiable -> receivesBroadcastNotificationsOn ( $ this -> notification );
75
75
}
76
76
77
- return get_class ($ this ->notification );
77
+ $ class = str_replace ('\\' , '. ' , get_class ($ this ->notifiable ));
78
+
79
+ return $ class .'. ' .$ this ->notifiable ->getKey ();
78
80
}
79
81
80
82
/**
@@ -86,23 +88,19 @@ public function broadcastWith()
86
88
{
87
89
return array_merge ($ this ->data , [
88
90
'id ' => $ this ->notification ->id ,
89
- 'type ' => $ this ->broadcastAs (),
91
+ 'type ' => $ this ->broadcastType (),
90
92
]);
91
93
}
92
94
93
95
/**
94
- * Get the broadcast channel name for the event .
96
+ * Get the type of the notification being broadcast .
95
97
*
96
98
* @return string
97
99
*/
98
- protected function channelName ()
100
+ public function broadcastType ()
99
101
{
100
- if (method_exists ($ this ->notifiable , 'receivesBroadcastNotificationsOn ' )) {
101
- return $ this ->notifiable ->receivesBroadcastNotificationsOn ($ this ->notification );
102
- }
103
-
104
- $ class = str_replace ('\\' , '. ' , get_class ($ this ->notifiable ));
105
-
106
- return $ class .'. ' .$ this ->notifiable ->getKey ();
102
+ return method_exists ($ this ->notification , 'broadcastType ' )
103
+ ? $ this ->notification ->broadcastType ()
104
+ : get_class ($ this ->notification );
107
105
}
108
106
}
0 commit comments