with one click
create-alert
Create and customize Alerts in the Laragear Alerts package.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Create and customize Alerts in the Laragear Alerts package.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | create-alert |
| description | Create and customize Alerts in the Laragear Alerts package. |
Use this skill when you need to create a new type of alert, add custom methods to an alert class, set default values, handle localization within alerts, or customize how an alert is rendered to HTML.
Generate a new alert class in app/Views/Alerts and its corresponding view in resources/views/alerts.
php artisan alert:create MyAlert
Add methods to the alert class to fluently set attributes using $this->set('key', $value).
public function type(string $type): static
{
return $this->set('type', $type);
}
Define defaults for the alert by overriding the getDefaults() method.
protected function getDefaults(): array
{
return [
'level' => 'info',
'dismissible' => true,
];
}
Handle translation within alert methods to keep the calling code clean.
public function message(string $key, array $replace = []): static
{
return $this->set('message', trans($key, $replace));
}
The toHtml() method determines how the alert is rendered. It should return a view with the alert's attributes.
public function toHtml(): mixed
{
return view('alerts.my-alert', $this->all());
}