DEV Community

Discussion on: Using laravel-echo with Nuxt.js

 
kp profile image
KP • Edited

@mankarsandesh thanks for sharing! by chance could you share the laravel side of this? An end to end example would be really helpful to me.

Thread Thread
 
eichgi profile image
Hiram

For backend channeling authentication you would have to specify that you are using Laravel sanctum like this, given I am using the api prefix I put this in routes/api.php:

Broadcast::routes(['middleware' => ['auth:sanctum']]);

And taking this route as example it should works:

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int)$user->id === (int)$id;
});

I hope this is the answer you were looking for

Thread Thread
 
kp profile image
KP

@eichgi I’ll have to give it a go - thanks for responding!