Slide 42
Slide 42 text
Improvement points to Laravel
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
Broadcast::channel('channels.{channel}', function (\App\User
$user, \App\Channel $channel) {
if (!$channel->exists || !$user->canJoin($channel)) {
return false;
}
$user->joinChannel($channel);
return [
'id' => $user->id,
'name' => $user->name,
'avatar_path' => $user->avatar_path,
];
});
channel "companies:*", SlackishphxWeb.CompanyChannel
channel "rooms:*", SlackishphxWeb.RoomChannel