Skip to content

Commit da662e4

Browse files
committed
working on broadcasting
1 parent 749528d commit da662e4

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
use Illuminate\Support\Facades\Broadcast;
7+
8+
class BroadcastServiceProvider extends ServiceProvider
9+
{
10+
/**
11+
* Bootstrap any application services.
12+
*
13+
* @return void
14+
*/
15+
public function boot()
16+
{
17+
Broadcast::route(['middleware' => ['web']]);
18+
19+
Broadcast::channel('channel-name.*', function ($user, $id) {
20+
return true;
21+
});
22+
}
23+
24+
/**
25+
* Register any application services.
26+
*
27+
* @return void
28+
*/
29+
public function register()
30+
{
31+
//
32+
}
33+
}

config/app.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
* Application Service Providers...
153153
*/
154154
App\Providers\AppServiceProvider::class,
155+
// App\Providers\BroadcastServiceProvider::class,
155156
App\Providers\AuthServiceProvider::class,
156157
App\Providers\EventServiceProvider::class,
157158
App\Providers\RouteServiceProvider::class,
@@ -175,6 +176,7 @@
175176
'Artisan' => Illuminate\Support\Facades\Artisan::class,
176177
'Auth' => Illuminate\Support\Facades\Auth::class,
177178
'Blade' => Illuminate\Support\Facades\Blade::class,
179+
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
178180
'Cache' => Illuminate\Support\Facades\Cache::class,
179181
'Config' => Illuminate\Support\Facades\Config::class,
180182
'Cookie' => Illuminate\Support\Facades\Cookie::class,

0 commit comments

Comments
 (0)