kesty/laravel-notifier

为Laravel ^8.0, ^9.0, ^10.0提供简单的通知小部件

3.0.1 2023-04-03 16:56 UTC

This package is auto-updated.

Last update: 2024-09-03 20:36:21 UTC


README

laravel ^7.* : ^8.* : ^9.* : ^10.0的通知系统

版本3.0支持图标、图像、布局和主题

安装

首先,通过Composer引入此包。

composer require kesty/laravel-notifier

然后,在app/config/app.php中包含服务提供者。(如果使用Laravel 7.5或更高版本,请跳过此步骤)

'providers' => [
    Kesty\LaravelNotifier\NotifierServiceProvider::class
];

最后,您需要发布配置和资产。

php artisan vendor:publish --provider="Kesty\LaravelNotifier\ServiceProvider"

设置

在您的HTML标签开始后插入以下内容 对于默认的bootstrap alert开发,使用以下内容

@include('vendor.laravel-notifier.messages')

对于Kesty Notify,使用以下内容

@include('vendor.laravel-notifier.notify')

控制器使用

// call the facade class
KestyNotify::info(title, body);
// or as function
kNotifier('Welcome to Laravel', 'Laravel', 'success');
kNotifier()->message('Welcome to Laravel', 'Laravel', 'info');

测试如下漂亮的自定义版本

kNotifier()->message('Welcome to Laravel', 'Great', null, 'fa-solid fa-check', '/assets/images/avatar.jpg', 'dark', 2);

请确保您有一个头像图像,并且已加载font-awesome图标。您可以使用您选择的任何图标,只需检查项目中的图标参数即可。

您可以根据需要修改/laravel-notifier/*.css。它是一个基本的iziToast样式。