Giter Site home page Giter Site logo

toastr-5.2-laravel's Introduction

toastr-5.2-laravel

toastr.js for Laravel 5.2

Bower

to install plugin via Bower run

bower install toastr

###1 Link to toastr.css <link href="toastr.css" rel="stylesheet"/>

###2 Link to toastr.js <script src="toastr.js"></script>

Installation

  1. Either run composer require narutimateum/toastr-5.2-laravel or add "narutimateum/toastr-5.2-laravel": "dev-master" to the require key in composer.json and run composer install

  2. Add 'narutimateum\Toastr\ToastrServiceProvider', to the providers key in config/app.php

  3. Add 'Toastr' => 'narutimateum\Toastr\Facades\Toastr', to the aliases key in config/app.php

Usage

Include jQuery and toastr.js and plugin styles in your master view template

after everything is done do

{!! Toastr::render() !!}

in your template just bofore body closing tag or after toastr.js script instantiated in your file.

You can use these methods in your controllers to insert a toast:

  • Toastr::warning($message, $title = null, $options = []) - add a warning toast
  • Toastr::error($message, $title = null, $options = []) - add an error toast
  • Toastr::info($message, $title = null, $options = []) - add an info toast
  • Toastr::success($message, $title = null, $options = []) - add a success toast
  • Toastr::add($type: warning|error|info|success, $message, $title = null, $options = []) - add a toast
  • Toastr::clear() - clear all current toasts don't forget to use it

Setting custom Toastr options

You can set custom options for Toastr. Run:

php artisan vendor:publish

to publish the config file for Toastr. Then edit config/toastr.php and set the options array to whatever you want to pass to Toastr. These options are set as the default options and can be overridden by passing an array of options to any of the methods in the Usage section.

###for example###

<?php

return [
    'options' => 
    ["progressBar" => true,
    "positionClass" =>"toast-bottom-right",
    "preventDuplicates"=> false,
    "showDuration" => 300,
    "hideDuration" => 1000,
    "timeOut" => 5000,
    "extendedTimeOut" => 1000,
    "showEasing" => "swing",
    "hideEasing"=> "linear",
    "showMethod" => "fadeIn",
    "hideMethod" => "fadeOut"]
    ];
    

For a list of available options, see toastr.js' documentation.

toastr-5.2-laravel's People

Contributors

borutojisan avatar

Watchers

James Cloos avatar Fredrik Hugås 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.