Answer the question
In order to leave comments, you need to log in
Laravel + pusher how to hide error?
How can I hide 403 forbidden error using lavarel and pusher? The situation is this: I have users on my page who can receive messages, and others who cannot - this is checked in channel.php, for example
Broadcast::channel('post.{id}', function ($user, $id) {
return *my expresion*;
});
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
public function broadcastOn()
{
return new PrivateChannel('post.' . $this->comment->post->id);
}
var channel = Echo.private('post.' + this.post.id);
channel.listen('NewComment', (comment) => {
console.log(comment);
});
Answer the question
In order to leave comments, you need to log in
How about checking if the user can listen to the channel or not even before you start listening to it and if they can't just not listen to the channel
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question