orus/flash
Composer 安装命令:
composer require orus/flash
包简介
A simple php and laravel flash alert package.
README 文档
README
this package gives you a simple way to manage alerts into your laravel project. It also works with any php project.
Installation
Include the package in your project using composer.
composer require orus/flash
If you're using a version of laravel prior to 5.5 you need you to include te service provider and the alias in your config/app.php.
"providers" => [ ... Orus\Flash\Providers\FlashServiceProvider::class, ], "aliases" => [ ... "Flash" => Orus\Flash\Facades\Flash::class ]
Usage
Before performing your redirect, you can call the flash() helper function.
Route::post("/login", function() { flash("welcome in the matrix"); return redirect("/profile"); }
You can specify the alert type by using the fluent api it offers.
flash(); // Flash object. flash()->default("message") // A default flash alert flash()->danger("message") // A danger flash alert flash()->warning("message") // A warning flash alert flash()->info("message") // An info flash alert flash()->success("message") // A success flash alert flash()->default("message")->title("Default") // Set the alert title flash()->danger("message")->important() // Set the alert as important flash()->info("message")->options(["key"] => "value") // Add options to the alert flash("message")->success(); // Or define your message and set the type. flash()->info("message")->success("message"); // You can chain multiple alerts.
It also gives you the ability to set multiple flash alerts.
Route::post("/login", function() { flash("welcome in the matrix")->default(); flash("May the code be with you!")->info(); return redirect("/profile"); }
Then you can get a collection of the alerts in your views.
{{ flash()->all() }}
统计信息
- 总下载量: 300
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-17