Laravel 5 Flash Notifications with icons and animations and with a timeout

Related tags

Laravel notify
Overview

Notify (Laravel)

Notify alert boxes to the browser with sound and font awesome icons and give it a timeout to fly out. Works great to notify the user after a successfull action (CRUD). Flash the information from Laravel or create multiple from javascript.

Want to see the current package in action, have a look at the project.

Laravel Starter Project

Installation

First, pull in the package through Composer.

"require": {
    "bpocallaghan/notify": "3.*"
}

OR

composer require bpocallaghan/notify

Laravel <5.4 only (Laravel 5.5 has automatic package discovery)

Include the service provider within config\app.php.

'providers' => [
    Bpocallaghan\Notify\NotifyServiceProvider::class,
];

Add a facade alias or use the globel helper function notify().

'aliases' => [
    'Notify' => Bpocallaghan\Notify\Facades\Notify::class,
];

Usage

Within any view file (preferable your master layout).

@include('notify::notify')

Within any Controller.

public function index()
{
    // helper function - default to the 'info'
    notify('Title', 'Description');
    
    // return object first
    notify()->info('Title', 'Description');
    
    // via the facade
    Notify::info('Title', 'Description');
    
    return view('home');
}

The different 'levels' are:

  • notify()->info('Title', 'Description');
  • notify()->success('Title', 'Description');
  • notify()->warning('Title', 'Description');
  • notify()->error('Title', 'Description');

The different arguments:

  • notify()->info('Title', 'Description', false); // without the icon
  • notify()->info('Title', 'Description', 'smile-o'); // specify the icon class
  • notify()->message($level = 'info', $title, $content, $icon, $timeout = 5000) // arguments
  • notify()->message('info', 'Title', 'Description', 'smile-o'); // specify the type of level
  • notify()->message('info', 'Title', 'Description', 'smile-o', 10000); // specify the timeout

If you need to modify the view partial, you can run:

php artisan vendor:publish --provider="Bpocallaghan\Notify\NotifyServiceProvider" --tag=view

The view partial can be found here resources\views\vendor\notify\notify.blade.

You need to publish the assets.

php artisan vendor:publish --provider="Bpocallaghan\Notify\NotifyServiceProvider" --tag=public

Find the files here public\vendor\notify\. Move the mp3s to public\sounds\. If you use Laravel Elixir, move the css and js to your resource\assets and include them in your gulpfile.js, otherwise link to the individual files in your html header.

TODO

  • Maybe a config file (sound on/off, sound path, position, fade in/out, etc)

Note

Please keep in mind this is for my personal workflow and might not fit your need. I developed this to help speed up my day to day workflow. Please let me know about any issues or if you have any suggestions.

My other Packages

You might also like...
Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster.

Laravel Kickstart What is Laravel Kickstart? Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster. It com

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app
Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.
Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and

Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.

Nebula Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS. Nebula m

A light weight laravel package that facilitates dealing with arabic concepts using a set of classes and methods to make laravel speaks arabic

A light weight laravel package that facilitates dealing with arabic concepts using a set of classes and methods to make laravel speaks arabic! concepts like , Hijri Dates & Arabic strings and so on ..

Laravel application project as Sheina Online Store backend to be built with Laravel and VueJS

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

A TALL (Tailwind CSS, Alpine.js, Laravel and Livewire) Preset for Laravel
A TALL (Tailwind CSS, Alpine.js, Laravel and Livewire) Preset for Laravel

Laravel TALL Preset A front-end preset for Laravel to scaffold an application using the TALL stack, jumpstarting your application's development. If yo

Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications.
Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications.

Laravel Boilerplate Project Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications. Table of Con

A Laravel Wrapper for the CoinDCX API. Now easily connect and consume the CoinDCX Public API in your Laravel apps without any hassle.
A Laravel Wrapper for the CoinDCX API. Now easily connect and consume the CoinDCX Public API in your Laravel apps without any hassle.

This package provides a Laravel Wrapper for the CoinDCX API and allows you to easily communicate with it. Important Note This package is in early deve

Comments
  • Create DETAILED_INSTALLATION.md

    Create DETAILED_INSTALLATION.md

    I have created a detailed installation guide for a fresh install of Laravel. I hope it helps. Please review the texts in English since my level of English is too low. thanks for your attention.

    hacktoberfest hacktoberfest-accepted hacktoberfest-approved 
    opened by elguitarraverde 1
Releases(3.0.1)
Owner
Ben-Piet O'Callaghan
Full Stack Developer at GDC Media and Laravel Developer at Bookamat
Ben-Piet O'Callaghan
A package to flash multiple messages using Laravels default session message flashing system

Flash multiple advanced messages with both text, messages and links An opinionated solution for flashing multiple advanced messages from the backend a

Bilfeldt 6 Jan 18, 2022
A helper package to flash a bootstrap alert to the browser via a Facade or a helper function.

Alert Box (Laravel) A helper package to flash a bootstrap alert to the browser via a Facade or a helper function. <div class="alert alert-info fade in

Ben-Piet O'Callaghan 17 Dec 30, 2022
A package to easily make use of Iconic icons in your Laravel Blade views.

Blade Iconic A package to easily make use of Iconic icons in your Laravel Blade views. For a full list of available icons see the SVG directory. Iconi

Malik Alleyne-Jones 17 Aug 25, 2022
A package to easily make use of Simple Icons in your Laravel Blade views.

Blade Simple Icons A package to easily make use of Simple Icons in your Laravel Blade views. For a full list of available icons see the SVG directory.

UB Labs 12 Jan 17, 2022
A package to easily make use of SVG icons in your Laravel Blade views.

Blade Icons A package to easily make use of SVG icons in your Laravel Blade views. Originally "Blade SVG" by Adam Wathan. Turn... <!-- camera.svg -->

Blade UI Kit 1.7k Jan 2, 2023
Sweetalert and Toaster notifications for Laravel livewire with support for tailwind and bootstrap.

Larabell Integrate livewire with sweetalert. Installation How to use Sweetalert Toast Available configuration Installation composer require simtabi/la

Simtabi 3 Jul 27, 2022
Laravel Authentication Log is a package Log user authentication details and send new device notifications.

Laravel Authentication Log is a package which tracks your user's authentication information such as login/logout time, IP, Browser, Location, etc. as well as sends out notifications via mail, slack, or sms for new devices and failed logins.

Anthony Rappa 540 Jan 5, 2023
Livewire Notifier is a simple notifications system with zero dependencies above TALL-stack

Livewire Notifier is a simple notifications system with zero dependencies above TALL-stack (Tailwind CSS, Alpine.JS, Laravel and Livewire).

CodeSPB 18 Jul 27, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
⚡ Laravel Charts — Build charts using laravel. The laravel adapter for Chartisan.

What is laravel charts? Charts is a Laravel library used to create Charts using Chartisan. Chartisan does already have a PHP adapter. However, this li

Erik C. Forés 31 Dec 18, 2022