riettotek/flashmsg
Composer 安装命令:
composer require riettotek/flashmsg
包简介
Optional package for Laravel to implement global alert messages
关键字:
README 文档
README
A good way to implement global alert messages in a laravel project
Usage
In a controller you can call static methods shown below.
FlashMsg::info('Just a plain message.');
FlashMsg::success('Item has been added.');
FlashMsg::warning('Service is currently under maintenance.');
FlashMsg::danger('An unknown error occured.');
Install - How to patch in
- run the command below
composer require riettotek/flashmsg
- If dont have auto discover, paste this line within providers array in config/app.php
Riettotek\FlashMsg\Providers\FlashMsgServiceProvider::class
- Render the messages. You can do it in three different ways:
- with this directive. U can customize the markup html in the config/flashmsg.php file
@alertsmsg
you got to publish the config file with this command:
php artisan vendor:publish --provider="Riettotek\FlashMsg\Providers\FlashMsgServiceProvider" --tag=config
- via facade already autoloaded u can store the messages in a variable and then loop through that
{{ $alerts = FlashMsg::messages() }}
- Publish the blade component in your project components folder
php artisan vendor:publish --provider="Riettotek\FlashMsg\Providers\FlashMsgServiceProvider" --tag=view
then use that like so:
<x-renderalerts/>
By publishing the view component (be aware that u dont have another blade file named 'renderalerts.blade.php' in the component folder)
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-10