2017 © Pedro Peláez
 

library laravel-toastr

toastr.js for laravel 5.5

image

brian2694/laravel-toastr

toastr.js for laravel 5.5

  • Wednesday, September 27, 2017
  • by brian2694
  • Repository
  • 1 Watchers
  • 11 Stars
  • 5,659 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 30 % Grown

The README.md

Inspired in whossun/laravel-toastr.., (*1)

I cloned the repository brian2694/laravel-toastr to update to Laravel 5.5, (*2)

laravel-toastr

Laravel Version Is Working?
10.x Yes
9.x Yes
8.x Yes
7.x Yes
6.x Yes
>= 5.5 Yes
<= 5.4 Yes

install

Using Composer, (*3)

composer require brian2694/laravel-toastr

Laravel >= 5.5

That's it! The package is auto-discovered on 5.5 and up!, (*4)

Laravel <= 5.4

Add the service provider to config/app.php, (*5)

Brian2694\Toastr\ToastrServiceProvider::class,

Optionally include the Facade in config/app.php if you'd like., (*6)

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

Options

You can set custom options for Reminder. Run:, (*7)

php artisan vendor:publish

to publish the config file for toastr., (*8)

You can see toastr's documentation to custom your need., (*9)

You can use toastr() function available., (*10)

Dependencies

jQuery toast, you need to add css and js to your html., (*11)

Basic

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

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

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

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

  • Toastr::clear();, (*16)

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

<?php

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

    return view('welcome');
});

Then, (*18)

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

<!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>

Use ViteJs / script type defaults to module

You can also set Toastr to use vitejs by default by registering Toastr::useVite() inside the AppServiceProvider., (*20)

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Brian2694\Toastr\Facades\Toastr;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Toastr::useVite();
    }
}

Upon registering, you can now use Toastr::message() and it set the script type to module., (*21)

Contributors

We'd like to thank the following individuals for their contributions to this project:, (*22)

  • Antonio Bruno - Set DOC on the Facade class.
  • aoradev44 - Set toastr message script type to module for using with vite

The Versions

27/09 2017

dev-master

9999999-dev https://github.com/brian2694/laravel-toastr

toastr.js for laravel 5.5

  Sources   Download

MIT

The Requires

 

by Avatar brian2694

laravel php notification toastr

27/09 2017

5.5.2

5.5.2.0 https://github.com/brian2694/laravel-toastr

toastr.js for laravel 5.5

  Sources   Download

MIT

The Requires

 

by Avatar brian2694

laravel php notification toastr

28/01 2017

1.0.1

1.0.1.0 https://github.com/brian2694/laravel-toastr

toastr.js for laravel 5.4

  Sources   Download

MIT

The Requires

 

by Avatar brian2694

laravel php notification toastr