Alert Deck
A Laravel app that exercises every alert realrashid/sweet-alert can produce — Blade, Livewire and Inertia.
#AlertDeck
A small Laravel application that exercises every alert realrashid/sweet-alert can produce — in Blade, in Livewire, and in Inertia.
Each button flashes one alert and redirects back, which is the round trip a real application makes. If the alert survives the redirect and renders, the session store, the middleware and the Blade directive all did their job.
#What it covers
| Section | What it shows |
|---|---|
| Icon shortcuts | success, error, warning, info, question |
| Toasts | plain and positioned |
| Timing | timer() with a progress bar, and persistent() |
| Buttons | confirmDelete(), custom labels and colours, reversed order |
| Content | html(), images, positioning, per-alert themes |
| Themes | all seven — light, dark, borderless, minimal, material-ui, bootstrap-4, wordpress-admin |
| Input | an input alert whose value is posted to a route with submitTo() |
| Middleware | redirect()->with('success', …) and a real failed validate() |
| Guarded actions | data-confirm-delete, data-confirm-method="PUT", and a guarded <form> |
| Livewire | alerts dispatched from a component, with no page reload |
| Inertia | an alert shared as a page prop and shown by the composable |
| v7 compatibility | alert()->success() and toast('…', 'success') |
alert:upgrade |
routes that were written against v7 and migrated by the command |
#Running it
git clone https://github.com/realrashid/alert-deck.git
cd alert-deck
composer install
cp .env.example .env
php artisan key:generate
php artisan serve
Then open http://localhost:8000.
The package's published JavaScript is committed under public/vendor/sweetalert
so this runs straight after a clone. To refresh it from the installed package:
php artisan alert:publish --assets --force
#The other pages
/inertia— an Inertia page. Vue and Inertia load from a CDN with an import map, so this needs no build step; the point is to exercise the package's Inertia integration rather than to ship a bundler config./edge-cases— the awkward shapes a guarded action has to survive: a click landing on a child element,target="_blank", a guarded button inside an unguarded form, aGETaction, and an element with nothing to submit.
#test-deck.php
A small harness that drives every route through the real HTTP kernel with a persistent session and CSRF token, then asserts the flashed alert actually reaches the rendered page after the redirect:
php test-deck.php
It catches the server half of the round trip. The parts that only fail in a browser — a theme that loses to an inline style, a listener that was never rendered — need the page itself.
#Licence
MIT.