philipealmeida / laravel-toastr by philipealmeida
forked from whossun/laravel-toastr

toastr.js for laravel 5.2 and 5.3
123
0
1
Package Data
Maintainer Username: philipealmeida
Maintainer Contact: whossun@gmail.com (whossun)
Package Create Date: 2016-12-13
Package Last Update: 2017-01-23
Language: PHP
License: MIT
Last Refreshed: 2024-04-14 15:04:02
Package Statistics
Total Downloads: 123
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

This is a fork of Whossun, laravel-toastr

laravel-toastr

install

Using Composer

composer require philipealmeida/laravel-toastr

Add the service provider to config/app.php

Philipealmeida\Toastr\ToastrServiceProvider::class,

Optionally include the Facade in config/app.php if you'd like.

'Toastr'  => Philipealmeida\Toastr\Facades\Toastr::class,

Options

You can set custom options for Reminder. Run:

php artisan vendor:publish

to publish the config file for toastr.

You can see toastr's documentation to custom your need.

You can use toastr() function available.

Dependencies

jQuery toast, you need to add css and js to your html.

Basic

  • Toastr::info('message', 'title', ['options']);

  • Toastr::success('message', 'title', ['options']);

  • Toastr::warning('message', 'title', ['options']);

  • Toastr::error('message', 'title', ['options']);

  • Toastr::clear();

  • Toastr()->info('message', 'title', ['options']);

<?php

Route::get('/', function () {
    Toastr::success('Messages in here', 'Title', ["positionClass" => "toast-top-center"]);

    return view('welcome');
});

Then

You should add {!! Toastr::message() !!} to your html.

<!DOCTYPE html>
<html>
    <head>
        <title>Laravel</title>
        <link rel="stylesheet" href="http://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css">
    </head>
    <body>
        <div class="container">
            <div class="content">
                <div class="title">Laravel 5</div>
            </div>
        </div>
		<script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
        <script src="http://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script>
        {!! Toastr::message() !!}
    </body>
</html>

MIT