The Streams platform provides an implementation agnostic service to include messages with the application response.
Messages will display once, and on the next page load. This is used for view responses.
Messages can provide standardized API errors.
Within your code, before the response is generated, make a call to the Messages
facade.
use Streams\Core\Support\Facades\Messages;
public function example()
{
Messages::success('Welcome aboard!');
return home();
}
You may also perform:
Messages::success(): // Set the flash theme to "success".
Messages::error(): // Set the flash theme to "danger".
Messages::warning(): // Set the flash theme to "warning".
Messages::overlay(): // Render the message as an overlay.
Messages::overlay([
'title' => 'Modal Title'
'message' => 'Modal Message',
]): // Display a modal overlay with a title.
Messages::danger(): // Render a "danger" flash message that must be dismissed.
Messages::important(): // Add a close button to the flash message.
With this message flashed, you may now display it in your views. Because messages and overlays are so common, we provide a template out of the box to get you started. You're free to use - and even modify to your needs - this template how you see fit.
@verbatim@include('streams::messages')@endverbatim
Any array data passed in, including the two mandatory type and content values.
@verbatim<ul>
@foreach (Messages::pull() as $message)
<li>{{ $message->type }}: {{ $message->content }}</li>
@endforeach@endverbatim
</ul>
A blank TALL-stack Laravel project with Streams.
The fundamental features and utilities offered by the Streams platform.
A universal and extensible RESTful API for Streams.
Extensible, user-friendly, and performant control panel, components, and services.
Dev tooling for Laravel Streams.