2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Broadcast;
|
2018-02-21 12:33:09 +08:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2017-06-09 02:28:26 +08:00
|
|
|
|
|
|
|
class BroadcastServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
Broadcast::routes();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Authenticate the user's personal channel...
|
|
|
|
*/
|
|
|
|
Broadcast::channel('App.User.*', function ($user, $userId) {
|
|
|
|
return (int) $user->id === (int) $userId;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|