class AnonymousEvent implements ShouldBroadcast

Traits

Properties

protected array $broadcastConnection

The broadcaster connection to use to broadcast the event.

from  InteractsWithBroadcasting
string|null $socket

The socket ID for the user that raised the event.

from  InteractsWithSockets
protected string|null $connection

The connection the event should be broadcast on.

protected string|null $name

The name the event should be broadcast as.

protected array $payload

The payload the event should be broadcast with.

protected bool $includeCurrentUser

Should the broadcast include the current user.

protected bool $shouldBroadcastNow

Indicates if the event should be broadcast synchronously.

Methods

static mixed
dispatch(mixed ...$arguments)

Dispatch the event with the given arguments.

static mixed
dispatchIf(bool $boolean, mixed ...$arguments)

Dispatch the event with the given arguments if the given truth test passes.

static mixed
dispatchUnless(bool $boolean, mixed ...$arguments)

Dispatch the event with the given arguments unless the given truth test passes.

broadcast(mixed ...$arguments)

Broadcast the event with the given arguments.

broadcastVia(UnitEnum|array|string|null $connection = null)

Broadcast the event using a specific broadcaster.

array
broadcastConnections()

Get the broadcaster connections the event should be broadcast on.

dontBroadcastToCurrentUser()

Exclude the current user from receiving the broadcast.

broadcastToEveryone()

Broadcast the event to everyone.

__construct(array|Channel|string $channels)

Create a new anonymous broadcastable event instance.

via(string $connection)

Set the connection the event should be broadcast on.

as(string $name)

Set the name the event should be broadcast as.

with(array|Arrayable $payload)

Set the payload the event should be broadcast with.

toOthers()

Broadcast the event to everyone except the current user.

void
sendNow()

Broadcast the event.

void
send()

Broadcast the event.

string
broadcastAs()

Get the name the event should broadcast as.

array
broadcastWith()

Get the payload the event should broadcast with.

array|Channel
broadcastOn()

Get the channels the event should broadcast on.

bool
shouldBroadcastNow()

Determine if the event should be broadcast synchronously.

Details

in Dispatchable at line 14
static mixed dispatch(mixed ...$arguments)

Dispatch the event with the given arguments.

Parameters

mixed ...$arguments

Return Value

mixed

in Dispatchable at line 22
static mixed dispatchIf(bool $boolean, mixed ...$arguments)

Dispatch the event with the given arguments if the given truth test passes.

Parameters

bool $boolean
mixed ...$arguments

Return Value

mixed

in Dispatchable at line 30
static mixed dispatchUnless(bool $boolean, mixed ...$arguments)

Dispatch the event with the given arguments unless the given truth test passes.

Parameters

bool $boolean
mixed ...$arguments

Return Value

mixed

in Dispatchable at line 38
static PendingBroadcast broadcast(mixed ...$arguments)

Broadcast the event with the given arguments.

Parameters

mixed ...$arguments

Return Value

PendingBroadcast

InteractsWithBroadcasting broadcastVia(UnitEnum|array|string|null $connection = null)

Broadcast the event using a specific broadcaster.

Parameters

UnitEnum|array|string|null $connection

Return Value

InteractsWithBroadcasting

array broadcastConnections()

Get the broadcaster connections the event should be broadcast on.

Return Value

array

InteractsWithSockets dontBroadcastToCurrentUser()

Exclude the current user from receiving the broadcast.

Return Value

InteractsWithSockets

InteractsWithSockets broadcastToEveryone()

Broadcast the event to everyone.

Return Value

InteractsWithSockets

at line 46
__construct(array|Channel|string $channels)

Create a new anonymous broadcastable event instance.

Parameters

array|Channel|string $channels

at line 54
AnonymousEvent via(string $connection)

Set the connection the event should be broadcast on.

Parameters

string $connection

Return Value

AnonymousEvent

at line 64
AnonymousEvent as(string $name)

Set the name the event should be broadcast as.

Parameters

string $name

Return Value

AnonymousEvent

at line 74
AnonymousEvent with(array|Arrayable $payload)

Set the payload the event should be broadcast with.

Parameters

array|Arrayable $payload

Return Value

AnonymousEvent

at line 88
AnonymousEvent toOthers()

Broadcast the event to everyone except the current user.

Return Value

AnonymousEvent

at line 98
void sendNow()

Broadcast the event.

Return Value

void

at line 108
void send()

Broadcast the event.

Return Value

void

at line 120
string broadcastAs()

Get the name the event should broadcast as.

Return Value

string

at line 132
array broadcastWith()

Get the payload the event should broadcast with.

Return Value

array

at line 140
array|Channel broadcastOn()

Get the channels the event should broadcast on.

Return Value

array|Channel

at line 148
bool shouldBroadcastNow()

Determine if the event should be broadcast synchronously.

Return Value

bool