ワンクリックで
create-alert
Create and customize Alerts in the Laragear Alerts package.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Create and customize Alerts in the Laragear Alerts package.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
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());
}