milanarandjelovic / noty
为 Laravel 提供的 Noty 通知包
v1.0.0
2019-03-17 12:12 UTC
Requires
- php: >=7.1.3
Requires (Dev)
- orchestra/testbench: ^3.7
- phpunit/phpunit: ^6.2|^7.0
This package is auto-updated.
Last update: 2024-09-18 07:27:55 UTC
README
安装步骤
需要此包
创建新的 Laravel 应用程序后,可以使用以下命令包含 Noty 包
composer require milanarandjelovic/noty
添加提供者和别名
在 config/app.php
中添加提供者和别名。
'providers' => [ // other providers MA\Noty\NotyServiceProvider::class, ] 'aliases' => [ // other aliases 'Noty' => MA\Noty\Facades\Noty::class, ]
发布配置和资源
作为可选步骤,如果您想修改默认配置,可以发布配置文件
php artisan vendor:publish --provider="MA\Noty\NotyServiceProvider" --tag="config" php artisan vendor:publish --provider="MA\Noty\NotyServiceProvider" --tag="public" --force
使用方法
在主视图模板中包含 Noty 资源和样式
<!doctype html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> @noty_styles </head> <body> <h1>Main view</h1> @noty_scripts @noty_render </body> </html>
示例
noty()->info('Info Message', 'Info') ->success('Success Message', 'Success') ->error('Error Message', 'Error') ->warning('Warning Message', 'Warning');
许可证
Noty 是开源软件,受 MIT 许可证 许可。