simonmarcellinden / toast
Toast Package fo Laravel. Shows toast messages on your Laravel project
Requires
- illuminate/support: ~7|~8
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
README
This is where your description should go. Take a look at contributing.md to see a to do list.
Installation
Via Composer
$ composer require simonmarcellinden/toast
Laravel <= 5.4
Add the service provider to config/app.php
SimonMarcelLinden\Toast\ToastServiceProvider::class,
Optionally include the Facade in config/app.php if you'd like.
'Toast' => SimonMarcelLinden\Toast\Facades\Toast::class,
Options
For publish the toast config file use the follow command Run:
php artisan vendor:publish
Usage
Basic
- Toast::info('message', 'title', ['options']);
Add a Toast message directly into your route or controller
<?php /** Route Example **/ Route::get('/', function () { Toast::info('Messages in here', 'Title', ["positionClass" => "toast-top-right"]); return view('welcome'); }); ?> <?php /** Controller Example **/ class TesConroller extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { Toast::info('Messages in here', 'Title', ["positionClass" => "toast-top-right"]); return view('welcome'); } } ?>
Then you should add {!! Toast::message() !!}
at the end of your HTML.
<!DOCTYPE html> <html> <head> <title>Laravel - Toast</title> <link href="{{ asset('css/toast.css') }}" rel="stylesheet"> <script src="{{ asset('js/toast.js') }}" type="text/javascript"></script> </head> <body> <div class="container"> <div class="content"> <div class="title">Laravel 5</div> </div> </div> {!! Toast::message() !!} </body> </html>
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email info@snerve.de instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.