Package Data | |
---|---|
Maintainer Username: | orus |
Maintainer Contact: | ycherif@orus.ci (Youssouf CHERIF) |
Package Create Date: | 2017-07-17 |
Package Last Update: | 2021-03-10 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-23 03:04:09 |
Package Statistics | |
---|---|
Total Downloads: | 299 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
this package gives you a simple way to manage alerts into your laravel project. It also works with any php project.
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
]
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() }}