webdo-cz / tall-flash
使用TALL stack实现的闪存消息
dev-main
2021-04-21 15:30 UTC
Requires
- php: >=7.3.0
- illuminate/support: ^7.0|^8.0
- livewire/livewire: ^1.2|^2.0
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-09-20 07:30:13 UTC
README
安装
通过composer安装
composer require webdo-cz/tall-flash
设置
在</body>
之前添加
<livewire:flash-messages />
使用方法
调用flash()
函数。
$flash = [ 'type' => 'success', 'title' => 'Success', 'message' => 'Post added to our database', ]; flash($flash, $this);
(这用于Livewire支持)
有两种类型:成功、错误。你可以使用这个简短函数
flashSuccess([ 'title' => 'Success', 'message' => 'Post added to our database', ], $this);
和
flashError([ 'title' => 'Error', 'message' => 'Something bad happen', ], $this);