How can I use broadcasting/auth for the admin but not for the normal user, and still both can chat with each other?
// BroadcastServiceProvider
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
// Channels.php
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id; });
Broadcast::channel('chat', function ($user) {
return $user; });
// MessageSent Event
public function broadcastOn()
{
return new PresenceChannel('chat');
}
I'm getting this error: POST http://localhost:8000/broadcasting/auth 403 (Forbidden), but when i remove from laravel echo (Echo.join('chat')) the error goes.