Rukhsar / laravel-sweetnotify by Rukhsar

A simple laravel package to show Sweet Alert notifications in blade templates.
143
1
2
Package Data
Maintainer Username: Rukhsar
Maintainer Contact: rukhsar.man@gmail.com (Rukhsar Manzoor)
Package Create Date: 2016-12-05
Package Last Update: 2016-12-05
Home Page:
Language: JavaScript
License: MIT
Last Refreshed: 2024-12-14 15:02:49
Package Statistics
Total Downloads: 143
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel SweetNotify

Add Sweet Alert notifications to Laravel application with ease.

Installation

Install using composer

composer require rukhsar/sweet-notify

After installing this package you have to add the service provider for this package to your config/app.php .


Rukhsar\SweetNotify\SweetNotifyServiceProvider::class

Copy the required assets by using

php artisan vendor:publish --tag=sweetnotify

This will copy the sweetalert.css and sweetalert.js to your public/css and public/js.

Then in your master view or layout add

<link rel="stylesheet" type="text/css" href="css/sweetalert.css">

and the JS script tag before your </body>

<script src="js/sweetalert.js"></script>

Include the SweetNotify template in your main view or layout file right after the script tag above.

    @include('SweetNotify::sweetnotify')

Usage

You can use SweetNotify notifications in you controllers, events and jobs. But I prefer to use them in controller just before redirecting to a view.

Following methods are available to use.


sweet('Title','Your Message');

sweet()->error('Title','Your Message');

sweet()->success('Title','Your Message');

sweet()->overlay('Title','Your Message');

Issues

If you have any question or issue, please open an Issue and I will try to fix it as soon as possible.

Thanks to

Sweet Alert - http://t4t5.github.io/sweetalert/