afrizalmy/laratoast-jquery is a Laravel package for toast jquery for laravel.
It currently has 0 GitHub stars and 19 downloads on Packagist (latest version v1.0.4).
Install it with composer require afrizalmy/laratoast-jquery.
Discover more Laravel packages by afrizalmy
or browse all Laravel packages to compare alternatives.
Last updated

| Laravel Version | Is Working? | | --- | --- | | 9.x | Yes | | 8.x | Yes | | 7.x | Yes | | 6.x | Yes |
Using Composer
composer require afrizalmy/laratoast-jquery
Then add the service provider to config/app.php. In Laravel versions 5.5 and above, this step can be skipped if package auto-discovery is enabled.
'providers' => [
...
Afrizalmy\Laratoast\LaratoastServiceProvider::class
...
];
As optional if you want to modify the default configuration, you can publish the configuration file:
php artisan vendor:publish --provider='Afrizalmy\Laratoast\LaratoastServiceProvider'
Include jQuery and your notification plugin assets in your view template:
@laratoast_css@laratoast_js@laratoast_render to render your notification@laratoast_jquery if you don't have jquerylaratoast() helper function inside your controller to set a toast notification for info, success, warning or error// Display an info toast
laratoast()->info("Are you married?","Information","bottom-right");
as an example:
<?php
namespace App\Http\Controllers;
use App\Post;
use App\Http\Requests\PostRequest;
use Illuminate\Database\Eloquent\Model;
class PostController extends Controller
{
public function store(PostRequest $request)
{
$post = Post::create($request->only(['title', 'body']));
if ($post instanceof Model) {
laratoast()->success("Data has been saved successfully!","Success","bottom-right",['textAlign'=>'left']);
return redirect()->route('posts.index');
}
laratoast()->error("An error has occurred please try again later.","Error!","bottom-center");
return back();
}
}
After that add the @laratoast_render at the bottom of your view to actualy render the laratoast notifications.
<!doctype html>
<html>
<head>
<title>afrizalmy/laratoast-jquery</title>
@laratoast_jquery <!-- if you don't have jquery -->
@laratoast_css
</head>
<body>
</body>
@laratoast_js
@laratoast_render
</html>
// laratoast()->success("Message","Title","position", "options");
laratoast()->success("Success notification test","Success","bottom-left");
// laratoast()->error("Message","Title","position", "options");
laratoast()->error("Error notification test","Error","bottom-right",['textAlign'=>'center']);
// laratoast()->warning("Message","Title","position", "options");
laratoast()->warning("Warning notification test","Warning","bottom-center",['textAlign'=>'right']);
// laratoast()->info("Message","Title","position", "options");
laratoast()->info("Info notification test","Info","top-left",['textAlign'=>'left']);
you can see the options in the config/laratoast file