1. Go to this page and download the library: Download hen8y/laravel-flash library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
/*
|--------------------------------------------------------------------------
| Timeout
|--------------------------------------------------------------------------
|
| Specifies the duration, in seconds, for which the notification will remain visible.
|
*/
"timeout" => 2000,
/*
|--------------------------------------------------------------------------
| Enable Cancel Button
|--------------------------------------------------------------------------
|
| Enable the close notification button
|
|
*/
"enable_cancel_btn" => true,
/*
|--------------------------------------------------------------------------
| Cancel Button Type
|--------------------------------------------------------------------------
|
| Choose if the flash notification should be svg or text.
|
*/
"cancel_btn_type" => "svg",
/**
* If text is chosen as btn_type, enter the text to be chosen below or
* leave default
*
*/
"btn_text" => "close",
/*
|--------------------------------------------------------------------------
| Flash Theme Colors
|--------------------------------------------------------------------------
|
| Specify the theme colors you want for your flash notification.
| If dark mode if enabled this would be used as light mode theme
|
| MUST BE HEX.
|
*/
"theme" => [
"info" => "#232113",
"success" => "#166534",
"error" => "#b91c1c",
],
/*
|--------------------------------------------------------------------------
| Enable Dark Mode
|--------------------------------------------------------------------------
|
| Set dark mode to true and specify the colors you want for your dark mode.
|
| MUST BE HEX.
|
*/
"enable_dark_mode" => false,
"dark-theme" => [
"info" => "#232113",
"success" => "#22c55e",
"error" => "#b91c1c",
]
];
Route::get('/test', function () {
flash('info', 'This is an info message');
return redirect('/');
});
blade
use Livewire\Volt\Component;
new class extends Component
{
public function refresh()
{
flash("info", "This is an info message");
$this->redirectRoute("home", navigate: true);
}
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.