Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
laragear-alerts-push-alert
laragear-alerts-push-alert
laragear/alerts
claude-code
alerts
push-notifications
flash-messages
persistent-alerts
conditional-push
deferred-push

Push alerts to the current or next request, push conditionally, make alerts persist across requests, or abandon persisted alerts. Exclude creating alert classes, rendering alerts in Blade, or Notification channels (use alerts-create, alerts-render, alerts-notify).

Install
php artisan boost:add-skill laragear/alerts

Save this content to: .claude/skills/push-alert/SKILL.md

# Push Alerts

Use inside controllers, actions, or middleware where the backend must tell
the user something.

## One-shot push

`push()` adds the alert to the bag for the current request — or the next one,
if the response is a redirect:

```php
MyAlert::push(['body' => 'Operation successful']);
```

## Conditional push

Prefer `pushWhen()` / `pushUnless()` over wrapping `push()` in an `if` —
the intent reads directly at the call site:

```php
MyAlert::pushWhen($user->isAdmin(), ['body' => 'Welcome, Admin!']);
```

## Persistent alerts (multi-request lifecycle)

A persistent alert survives requests **until explicitly abandoned**. Follow
this exact order:

1. Persist with a stable, semantic key:
   `MyAlert::push(['body' => 'Disk full'])->persistAs('disk.full');`
2. Abandon when the condition is resolved, in the code path that resolves it:
   `MyAlert::abandon('disk.full');`

**Success state:** the alert no longer appears after `abandon()`.
**Failure state:** the alert reappears on every request — the abandon path
was never reached. Wire `abandon()` to the action that resolves the condition
(e.g., the controller that fixes it), not to an arbitrary page.

## Deferred push

When the alert must pass through other logic before being bagged, build with
`make()` and bag it later:

```php
$alert = MyAlert::make(['body' => 'Wait for it...']);
// ... logic that decides ...
$alert->pushToBag();
```

Push Alerts

Use inside controllers, actions, or middleware where the backend must tell the user something.

One-shot push

push() adds the alert to the bag for the current request — or the next one, if the response is a redirect:

MyAlert::push(['body' => 'Operation successful']);

Conditional push

Prefer pushWhen() / pushUnless() over wrapping push() in an if — the intent reads directly at the call site:

MyAlert::pushWhen($user->isAdmin(), ['body' => 'Welcome, Admin!']);

Persistent alerts (multi-request lifecycle)

A persistent alert survives requests until explicitly abandoned. Follow this exact order:

  1. Persist with a stable, semantic key: MyAlert::push(['body' => 'Disk full'])->persistAs('disk.full');
  2. Abandon when the condition is resolved, in the code path that resolves it: MyAlert::abandon('disk.full');

Success state: the alert no longer appears after abandon(). Failure state: the alert reappears on every request — the abandon path was never reached. Wire abandon() to the action that resolves the condition (e.g., the controller that fixes it), not to an arbitrary page.

Deferred push

When the alert must pass through other logic before being bagged, build with make() and bag it later:

$alert = MyAlert::make(['body' => 'Wait for it...']);
// ... logic that decides ...
$alert->pushToBag();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core