realrashid/sweet-alert/sweet-alert-development
Claude Code and agent skill by realrashid/sweet-alert
- community
Checking that the SKILL.md file is still in the repository.
Build SweetAlert2 flows in Laravel with realrashid/sweet-alert v8 — flashing alerts and toasts, input dialogs that post their value, and confirmation dialogs for destructive or irreversible actions.
Install
npx vskill@latest install realrashid/sweet-alert/sweet-alert-developmentSKILL.md
Sweet Alert Development
When to use this skill
Reach for this when a Laravel application needs a modal, a toast, an input prompt, or a confirmation before a destructive action, and the project already depends on realrashid/sweet-alert.
It covers v8. The v8 API is a fluent builder and differs from v7 in a few places that fail quietly, so check the version in composer.json before writing code against it. On a v7 codebase, run the migration command rather than editing call sites by hand:
The mental model
An alert is built in PHP, flashed to the session, and rendered by the @sweetAlert directive on the next response. That means the normal shape is "flash, then redirect" — exactly like with('status', ...).
The five icon shortcuts (success, error, warning, info, question) display on their own when given a title. A chain you compose yourself — starting from Alert::title(), Alert::make() or Alert::input() — must end with flash().
Common tasks
Toast instead of a modal
Ask before a destructive action
Put the attribute on the link. No controller change and no JavaScript:
For anything that is not a delete, name the method:
Or guard the whole form:
Per-element copy: data-confirm-title, data-confirm-text, data-confirm-icon, data-confirm-button, data-confirm-cancel. Defaults live in the confirm and confirm_delete blocks of config/sweetalert.php.
Collect a value from the user
Without submitTo() the dialog closes and the value is discarded. For server-side validation while the dialog is still open, use preConfirmRoute($url), which expects JSON of the shape {"valid": false, "message": "..."}.
Render a Blade view inside the alert
Livewire
Session-flashed alerts do not fire on a Livewire update, so dispatch a browser event instead:
sweetToast() and sweetInput() are there too, with dispatchToast() and dispatchInput().
Setup, if the package is not installed yet
Then put the directive at the end of the layout body:
Individual publish tags are sweetalert-config, sweetalert-views and sweetalert-asset, or use php artisan alert:publish --config.
Pitfalls
- `html()` takes one argument. v7's was
html($title, $code, $icon). PHP
ignores surplus arguments, so a v7 call still runs and renders nothing at all. Set the title with title().
- `view()` takes the view name first. v7 put the title first, so an
un-migrated call tries to render a view named after the title.
- `Alert::input()` and `Alert::make()` never flash themselves. End the
chain with flash().
- Do not set `background()`, `width()` or `padding()` casually.
SweetAlert2 applies each as an inline style on the popup, which overrides every theme stylesheet, so a stray background() makes themes do nothing.
- `@sweetAlert` belongs at the end of `<body>`, not in
<head>. - The container binding is `app('alert')`.
app('sweet-alert')was v7. - Do not hand-write
Swal.fire(...)for confirmations. Usedata-confirm—
it already handles the CSRF token, the method spoofing and the form.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingresources/boost/skills/sweet-alert-development/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 3 Oct 2026, a month ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/realrashid/sweet-alert/sweet-alert-development)