Inspired in brian2694/laravel-toastr.
A simple plugin to display a material concept toast (alert message) for laravel
Using Composer
composer require amirardakani/mdtoast
That's it! The package is auto-discovered on 5.5 and up!
Add the service provider to config/app.php
Amirardakani\\MaterialToast\\ToastServiceProvider::class,
Optionally include the Facade in config/app.php if you'd like.
'Toast' => Amirardakani\\MaterialToast\\Facades\\Toast::class,
You can see Material-Toast documentation to custom your need.
- Toast::info('message', 'duration: 10000');
-
Toast::info('message', 'options');
-
Toast::success('message', 'options');
-
Toast::warning('message', 'options');
-
Toast::error('message', 'options');
-
Toast::clear();
-
Toast()->info('message', 'options');
<?php
Route::get('/', function () {
Toast::success('Messages in here');
return view('welcome');
});
Then
You should add {!! Toast::message() !!}
to your html.
<!DOCTYPE html>
<html>
<head>
<title>Laravel</title>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/dmuy/Material-Toast/454e0a2/mdtoast.min.css">
</head>
<body>
<div class="container">
<div class="content">
<div class="title">Laravel 5</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/dmuy/Material-Toast/454e0a2/mdtoast.min.js"></script>
{!! Toast::message() !!}
</body>
</html>