Giter VIP home page Giter VIP logo

notify's Introduction

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 my starter project. ####Laravel Starter Project

Installation

First, pull in the package through Composer.

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

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, $iconSmall, $timeout = 5000) // arguments
  • notify()->message('info', 'Title', 'Description', 'smile-o'); // specify the type of level
  • notify()->message('info', 'Title', 'Description', 'smile-o', 'thumbs-o-up'); // show a different small icon
  • notify()->message('info', 'Title', 'Description', 'smile-o', 'thumbs-o-up', 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)
  • Cleanup code (decide on the animations.css)
  • Maybe add a bigger box
  • Maybe add a 'modal' option (bootstrap's modal)

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

notify's People

Contributors

bpocallaghan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.