Skip to main content
The Toast facade is a Laravel facade that provides static access to the Toaster class. It offers a simple and clean API for creating toast notifications.

Quick start

Methods

success()

Create a success toast notification.
string
required
The message to display in the toast notification.
string | null
default:"null"
An optional title for the toast notification.
int | null
default:"null"
Duration in milliseconds to display the toast. If not provided, uses the default from configuration.
Returns: Toaster instance for method chaining Example:

error()

Create an error toast notification.
string
required
The error message to display in the toast notification.
string | null
default:"null"
An optional title for the toast notification.
int | null
default:"null"
Duration in milliseconds to display the toast. If not provided, uses the default from configuration.
Returns: Toaster instance for method chaining Example:

info()

Create an informational toast notification.
string
required
The informational message to display.
string | null
default:"null"
An optional title for the toast notification.
int | null
default:"null"
Duration in milliseconds to display the toast. If not provided, uses the default from configuration.
Returns: Toaster instance for method chaining Example:

warning()

Create a warning toast notification.
string
required
The warning message to display.
string | null
default:"null"
An optional title for the toast notification.
int | null
default:"null"
Duration in milliseconds to display the toast. If not provided, uses the default from configuration.
Returns: Toaster instance for method chaining Example:

add()

Create a toast notification with a specific level.
string
required
The message to display in the toast notification.
ToastLevel
default:"ToastLevel::Info"
The level/type of the toast. Can be ToastLevel::Success, ToastLevel::Error, ToastLevel::Info, or ToastLevel::Warning.
string | null
default:"null"
An optional title for the toast notification.
int | null
default:"null"
Duration in milliseconds to display the toast. If not provided, uses the default from configuration.
Returns: Toaster instance for method chaining Example:

Method chaining

All methods return the Toaster instance, allowing you to chain multiple toast notifications:

Additional methods

hasPending()

Check if there are pending toasts that have been added.
Returns: bool - true if there are pending toasts, false otherwise Example:

getPropKey()

Get the Inertia prop key used for toast notifications.
Returns: string - The prop key (default: 'toasts') Example:
The Toast facade is bound to the Toaster class in the Laravel service container. All method calls are forwarded to the Toaster instance.