eightynine/filament-page-alerts

在任何纤维页面上显示更多侵入性警报

v3.0.0 2024-07-21 15:46 UTC

This package is auto-updated.

Last update: 2024-08-29 05:23:20 UTC


README

在任何纤维页面上显示更具侵略性的警报

Latest Version on Packagist Total Downloads

🛠️ 加入我们的旅程

嗨,我是Eighty Nine。我创建了页面警报插件来解决作为开发者所面临的真实问题。您的赞助将使我能够投入更多时间来增强这些工具并帮助更多的人。 成为赞助商 并与我一起在开发者社区中产生积极影响。

简介

此包在任何页面上显示警报,而不仅仅是仪表板,目前警报出现在页面顶部。

Package screenshot

安装

您可以通过composer安装此包

composer require eightynine/filament-page-alerts

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="filament-page-alerts-config"

这是已发布配置文件的内容

use Filament\View\PanelsRenderHook;

return [

    /**
     * Render hook
     * 
     * The render hook to use for the alerts
     */
    "render-hook" => PanelsRenderHook::PAGE_START
];

用法

将插件添加到您的面板服务提供商

    public function panel(Panel $panel): Panel
    {
        return $panel
            //...
            //...
            ->plugin(FilamentPageAlertsPlugin::make())
            ->spa();
    }

您可以使用PageAlert类向您的页面发送警报!

    return [
            Actions\CreateAction::make(),
            Actions\Action::make('show notification')
                ->action(function () {
                    PageAlert::make()
                        ->title('Saved successfully')
                        ->body('Yey.. Your changes have been saved: ' . now())
                        ->success()
                        ->send();
                    PageAlert::make()
                        ->title('Saved failure')
                        ->body('Ooops, Your changes have not been saved! ')
                        ->danger()
                        ->send();
                    PageAlert::make()
                        ->title('This requires your attention')
                        ->body('Hey there, this is important')
                        ->warning()
                        ->url('https://www.google.com', 'Google')
                        ->send();
                    PageAlert::make()
                        ->title('You need to check this out')
                        ->body('This looks like something worth your attention')
                        ->info()
                        ->send();
                }),
        ];

致谢

许可证

MIT许可证(MIT)。请参阅许可证文件了解更多信息。