Move broadcast channel registration to a routes file.
These are very similar to routes in that they are channel endpoints that your application supports and they also fully support route model binding in Laravel 5.4. Upgraded applications do not need to make this change if they do not want to.
This commit is contained in:
parent
b748931666
commit
52f0196fd3
|
@ -16,11 +16,6 @@ public function boot()
|
||||||
{
|
{
|
||||||
Broadcast::routes();
|
Broadcast::routes();
|
||||||
|
|
||||||
/*
|
require base_path('routes/channels.php');
|
||||||
* Authenticate the user's personal channel...
|
|
||||||
*/
|
|
||||||
Broadcast::channel('App.User.{userId}', function ($user, $userId) {
|
|
||||||
return (int) $user->id === (int) $userId;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,7 @@
|
||||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||||
|
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||||
'Config' => Illuminate\Support\Facades\Config::class,
|
'Config' => Illuminate\Support\Facades\Config::class,
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Broadcast Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may register all of the event broadcasting channels that your
|
||||||
|
| application supports. The given channel authorization callbacks are
|
||||||
|
| used to check if an authenticated user can listen to the channel.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Broadcast::channel('App.User.{id}', function ($user, $id) {
|
||||||
|
return (int) $user->id === (int) $id;
|
||||||
|
});
|
Loading…
Reference in New Issue