萨迈耶 / laravel-flash
我的第一个Laravel插件,基于 https://github.com/laracasts/flash
dev-master
2019-09-17 20:00 UTC
Requires
- php: >=5.4.0
- illuminate/support: >=5.0
This package is auto-updated.
Last update: 2024-09-18 07:12:41 UTC
README
我的第一个插件,基于 https://github.com/laracasts/flash
这是一个专门设计为基于会话的警告,用于错误等。
不应该将其用作通用警告。
如何创建警告
要创建警告
Flash::error('You got hell to pay')
它支持以下类型的警告
- 错误
- 成功
- 警告
- 信息
如何使其可关闭
只需添加一个布尔值参数 true
或 false
,根据您是否希望它可关闭。
Flash::error('You got hell to pay', true)
此警告可以关闭,因为它有第二个参数 true
。
如何在模板中显示警告
简单
@include('flash::flash')
此插件在其视图命名空间中注册了所有视图,并且只有一个视图,flash
。
此插件还注册了视图以进行发布,因此您可以通过这种方式启用视图被覆盖:
php artisan vendor:publish --provider="sammaye\Flash\Providers\FlashServiceProvider"