File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 228
228
'whitelist ' => true ,
229
229
],
230
230
'database_connection ' => env ('TOTEM_DATABASE_CONNECTION ' ),
231
+
232
+ 'broadcasting ' => [
233
+ 'enabled ' => env ('TOTEM_BROADCASTING_ENABLED ' , true ),
234
+ 'channel ' => env ('TOTEM_BROADCASTING_CHANNEL ' , 'task.events ' ),
235
+ ],
231
236
];
Original file line number Diff line number Diff line change 2
2
3
3
namespace Studio \Totem \Events ;
4
4
5
- use Studio \Totem \Task ;
6
5
use Illuminate \Broadcasting \PrivateChannel ;
7
6
use Illuminate \Broadcasting \InteractsWithSockets ;
8
7
use Illuminate \Contracts \Broadcasting \ShouldBroadcast ;
@@ -12,27 +11,22 @@ class BroadcastingEvent extends TaskEvent implements ShouldBroadcast
12
11
use InteractsWithSockets;
13
12
14
13
/**
15
- * @var Task
16
- */
17
- public $ task ;
18
-
19
- /**
20
- * constructor.
14
+ * Get the channels the event should broadcast on.
21
15
*
22
- * @param Task $task
16
+ * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]|PrivateChannel
23
17
*/
24
- public function __construct ( Task $ task )
18
+ public function broadcastOn ( )
25
19
{
26
- parent :: __construct ( $ task );
20
+ return new PrivateChannel ( config ( ' totem.broadcasting.channel ' ) );
27
21
}
28
22
29
23
/**
30
- * Get the channels the event should broadcast on .
24
+ * Toggles event broadcasting on/off based on config value .
31
25
*
32
- * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]|PrivateChannel
26
+ * @return bool
33
27
*/
34
- public function broadcastOn ()
28
+ public function broadcastWhen ()
35
29
{
36
- return new PrivateChannel ( ' task.events ' );
30
+ return config ( ' totem.broadcasting.enabled ' );
37
31
}
38
32
}
You can’t perform that action at this time.
0 commit comments