GithubHelp home page GithubHelp logo

willyw2k / laravel-notify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mckenziearts/laravel-notify

0.0 1.0 0.0 1.13 MB

Flexible Flash notifications for Laravel

License: Other

PHP 11.91% CSS 48.57% JavaScript 2.07% HTML 37.44%

laravel-notify's Introduction

Build Status Total Downloads Latest Stable Version License

Introduction

Laravel Notify is a package that lets you add custom notifications to your project. A diverse range of notification design is available and many are coming soon.

Work In Progress

This package is still under active development.

Installation

You can install the package using composer

$ composer require mckenziearts/laravel-notify

Then add the service provider to config/app.php. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.

'providers' => [
    ...
    Mckenziearts\Notify\LaravelNotifyServiceProvider::class
    ...
];

You can publish the configuration file and assets by running:

$ php artisan vendor:publish --provider='Mckenziearts\Notify\LaravelNotifyServiceProvider'

Now that we have published a few new files to our application we need to reload them with the following command:

$ composer dump-autoload

Usage

  1. Add styles links with @notifyCss
  2. Add scripts links with @notifyJs
  3. use notify() helper function inside your controller to set a toast notification for info, success, warning or error
  4. Include notify partial to your master layout @include('notify::messages')

Basic

Within your controllers, before you perform a redirect call the notify method with a message.

public function store()
{
    notify()->success('Laravel Notify is awesome!');

    return Redirect::home();
}

An complete example:

<!doctype html>
<html>
    <head>
        <title>Laravel Notify</title>
        @notifyCss
    </head>
    <body>
        
        
        @notifyJs
        @include('notify::messages')
    </body>
</html>

Type of notifications

Laravel Notify actually display 4 types of notifications

  1. toast notification, who is default notification for Laravel Notify
notify()->success('Welcome to Laravel Notify ⚡️')
  1. connectify notification, example of basic usage
connectify('success', 'Connection Found', 'Success Message Here')
  1. drakify (😎) notification, only to display an alert
drakify('success') // for success alert 
or
drakify('error') // for error alert 
  1. smilify notification, a simple custom toast notification using smiley 😊
smilify('success', 'You are successfully reconnected')

Config

Config file are located at config/notify.php after publishing provider element.

Some awesome stuff. To active dark mode update the theme config, or add global variable NOTIFY_THEME on your .env file

'theme' => env('NOTIFY_THEME', 'dark'),

Got result like that

Laravel Notify use animate.css to set smooth animation to display and hide notify element.

/*
|--------------------------------------------------------------------------
| Animate Module (use animate.css)
|--------------------------------------------------------------------------
|
| Use animate.css to animate the notice.
|
*/

'animate' => [
    'in_class' => 'bounceInRight', // The class to use to animate the notice in.
    'out_class' => 'bounceOutRight', // The class to use to animate the notice out.
    'timeout'   => 5000 // Number of seconds before the notice disappears
],

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.

laravel-notify's People

Contributors

mckenziearts avatar

Watchers

James Cloos 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.