0
在事件中使用implement ShouldBroadcast
时,是否有一种简单的方法可以有条件地进行广播?例如:Laravel的有条件广播
/**
* Get the channels the event should be broadcast on.
*
* @return array
*/
public function broadcastOn()
{
if ($x == 2) return;
return ['test_channel'];
}
不幸的是上面还能造成排队的作业的代码,它不会成功,并且继续尝试,但不能因为它不具有的频道名称。有没有简单的方法来抑制$x == 2
创建的作业?
这很有效,谢谢,我非常头疼。 –
很高兴帮助!刚刚发布为下面的答案。 – jszobody