trait HasToasts

Trait HasToasts.

Provides a fluent interface for dispatching toast notifications from Livewire components.

Properties

protected object|null $_beartropy_toast_proxy
protected $component

Methods

object
toast()

Get the toast proxy instance.

__construct($component)

No description

success(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send a success toast.

error(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send an error toast.

info(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send an info toast.

warning(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send a warning toast.

send($type, $title, $message, $duration, $position)

No description

Details

at line 24
object toast()

Get the toast proxy instance.

Allows usage like $this->toast()->success('Message').

Return Value

object

Proxy instance with success(), error(), info(), warning() methods.

at line 29
__construct($component)

No description

Parameters

$component

at line 41
success(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send a success toast.

Parameters

string $title
string $message
int $duration
string|null $position

at line 53
error(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send an error toast.

Parameters

string $title
string $message
int $duration
string|null $position

at line 65
info(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send an info toast.

Parameters

string $title
string $message
int $duration
string|null $position

at line 77
warning(string $title, string $message = '', int $duration = 4000, string|null $position = null)

Send a warning toast.

Parameters

string $title
string $message
int $duration
string|null $position

at line 82
protected send($type, $title, $message, $duration, $position)

No description

Parameters

$type
$title
$message
$duration
$position