Install
Using Composer, (*1)
composer require jaghoub/izitools
Add the service provider to config/app.php, (*2)
jaghoub\izitools\izitoolsServiceProvider::class,
Optionally include the Facade in config/app.php if you'd like., (*3)
'izitools' => jaghoub\izitools\Facades\izitools::class,
Usage
Basic
From your application, call the izime method with a options and type., (*4)
include styles, (*5)
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.1.1/css/iziToast.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izimodal/1.4.2/css/iziModal.css" />
include javascript, (*6)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.1.1/js/iziToast.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/izimodal/1.4.2/js/iziModal.min.js"></script>
if use Facade, (*7)
izitools()->izime('tosat', [
'title'=> 'Welcome to laravel Website Test !',
'message'=>'is simply dummy text of the printing and typesetting industry. ',
'color'=>'green',
'position'=>'center'
]);
---
or
---
izitools()->izime('modal', [
'title'=> 'Welcome to laravel Website Test !',
'iframe'=>true,
'iframeHeight'=>800,
'iframeURL'=>'http://izimodal.dolce.ninja'
]);
without Facade, (*8)
izitools::izime('tosat', [
'title'=> 'Welcome to laravel Website Test !',
'message'=>'is simply dummy text of the printing and typesetting industry. ',
'color'=>'green',
'position'=>'center'
]);
---
or
---
izitools::izime('modal', [
'title'=> 'Welcome to laravel Website Test !',
'iframe'=>true,
'iframeHeight'=>800,
'iframeURL'=>'http://izimodal.dolce.ninja'
]);
Within a view, you can now check if a flash message exists and output it., (*9)
@if (izitools::ready())
{{ izitools::type() }}
@endif
Options
You can pass additional options to the izime method, which are then easily accessible within your view., (*10)
izitools::izime('modal', [
'title'=> 'Welcome to laravel Website Test !',
etc ...
]);
Then, in your view without Facade., (*11)
@if (izitools::ready())
@endif
with using Facade, (*12)
@if (izitools()->ready())
@endif
its not suggested to use {!! !!} method on real app it will allow the attack of XSS unless you are sure about data will be pushed ., (*13)
'better user the method izitools::option("option_name")'
Built With
The above example uses izimodal,izitosat but the flexibily of izitools means you can easily use it with any JavaScript alert solution., (*14)
Issues and contribution
Just submit an issue or pull request through GitHub. Thanks!, (*15)