بنقرة واحدة
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());
}