noty
vel 8
Laravel包装将美丽的Noty通知纳入Laravel作为Flash消息。
使用Noty版本3.2.0测试。

通过作曲家
$ composer require sarfraznawaz2005/noty对于Laravel <5.5:
在providers部分中将服务提供商添加到config/app.php
Sarfraznawaz2005 Noty NotyServiceProvider::class,通过运行下面的命令发布包的配置文件:
$ php artisan vendor:publish --provider= " Sarfraznawaz2005NotyNotyServiceProvider "它应该发布config/noty.php配置文件。
在使用此软件包之前,请确保通过使用NPM/YARN/ETC或直接包括其CSS和JS文件,请确保将Noty库包括在项目中:
< head >
< link rel =" stylesheet " href =" /noty.css " />
< script type =" text/javascript " src =" /noty.js " > </ script >
</ head >然后将其添加到您的视图/布局文件中:
@ include ( ' noty::view ' )句法:
noty ( $ message , $ type = '' , array $ options = [])在您的控制器中,您现在可以做:
public function store ()
{
noty ( ' Success Message ' , ' success ' );
return redirect ()-> back ();
}以下是您可以发送的通知类型:
noty ( ' Your Message ' ); // default ( info )
noty ( ' Your Message ' , ' success ' );
noty ( ' Your Message ' , ' error ' );
noty ( ' Your Message ' , ' warning ' );
noty ( ' Your Message ' , ' alert ' );使用$options ,您还可以覆盖各个通知的noty配置值示例:
noty ( ' My Notification ' , null , [ ' layout ' => ' top ' , ' timeout ' => 5000 ]);请参阅许可证文件以获取更多信息。