class TestEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
//All public attributes will be sent with the message
public $id;
public $event = 'test_event';
public function __construct()
{
$this->id = 123;
}
public function broadcastOn()
{
//List of channels where this event should be sent
return ['/test_event'];
}
}
class TestController extends Controller
{
public function test() {
event(new TestEvent());
return view('main');
}
}
{
id: 123,
event: 'test_event'
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.