com um clique
create-alert
Create and customize Alerts in the Laragear Alerts package.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Create and customize Alerts in the Laragear Alerts package.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
| 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());
}