Simple Flash Alert for Laravel
Flash Alert for Laravel, Elegant, responsive, flexible and lightweight notification plugin with no dependencies, simple and easy to use, (*1)
Getting Started
How to use this packages, (*2)
Installing
composer require ken/flash-me
and, (*3)
php artisan vendor:publish --tag="flashMe"
Optional Setting
config/flash_me.php, (*4)
/**
* Change this /path if you load assets from local
* example 'css' => asset('/css/app.css'),
*/
return [
'css' => 'https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.1.5/css/iziToast.min.css',
'js' => 'https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.1.5/js/iziToast.min.js',
];
resources/lang/en/flash_me.php, (*5)
return [
'success' => [
'type' => 'success',
'title' => 'Hi...',
'message' => 'FlashMe is Ready!',
'options' => [
'position' => 'topRight', // this is an example option, you can add another option
'transitionIn' => 'bounceInLeft',
'transitionOut' => 'fadeOut',
],
],
'info' => [
'type' => 'info',
'title' => 'Hi...',
'message' => 'FlashMe is Ready!',
'options' => [
'position' => 'topRight', // this is an example option, you can add another option
'transitionIn' => 'bounceInLeft',
'transitionOut' => 'fadeOut',
],
],
'warning' => [
'type' => 'warning',
'title' => 'Hi...',
'message' => 'FlashMe is Ready!',
'options' => [
'position' => 'topRight', // this is an example option, you can add another option
'transitionIn' => 'bounceInLeft',
'transitionOut' => 'fadeOut',
],
],
'error' => [
'type' => 'error',
'title' => 'Hi...',
'message' => 'FlashMe is Ready!',
'options' => [
'position' => 'topRight', // this is an example option, you can add another option
'transitionIn' => 'bounceInLeft',
'transitionOut' => 'fadeOut',
],
],
];
other options can use, (*6)
id: null,
class: '',
title: '',
titleColor: '',
titleSize: '',
titleLineHeight: '',
message: '',
messageColor: '',
messageSize: '',
messageLineHeight: '',
backgroundColor: '',
theme: 'light', // dark
color: '', // blue, red, green, yellow
icon: '',
iconText: '',
iconColor: '',
image: '',
imageWidth: 50,
maxWidth: null,
zindex: null,
layout: 1,
balloon: false,
close: true,
closeOnEscape: false,
rtl: false,
position: 'bottomRight', // bottomRight, bottomLeft, topRight, topLeft, topCenter, bottomCenter, center
target: '',
targetFirst: true,
toastOnce: false,
timeout: 5000,
animateInside: true,
drag: true,
pauseOnHover: true,
resetOnHover: false,
progressBar: true,
progressBarColor: '',
progressBarEasing: 'linear',
overlay: false,
overlayClose: false,
overlayColor: 'rgba(0, 0, 0, 0.6)',
transitionIn: 'fadeInUp',
transitionOut: 'fadeOut',
transitionInMobile: 'fadeInUp',
transitionOutMobile: 'fadeOutDown',
Usage
How to use if you will send flash alert to view?
example if this is controller on your project, (*7)
public function testFlash()
{
flashMe()->success();
return view('your_view');
}
Another function
flashMe()->success();
flashMe()->info();
flashMe()->warning();
flashMe()->error();
Display
you can display on your master template or single blade, before end of body tag, (*8)
@if (flashMe()->ok())
{!! flashMe_flash() !!}
@endif
Built With
Demo
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us., (*9)
License
This project is licensed under the MIT License - see the LICENSE.md file for details, (*10)