leantony/laravel-flash

Flash notifier based on Jeffery Way's laracasts/flash that uses toast js

Installs: 132

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Language:JavaScript

1.0 2018-02-21 20:38 UTC

This package is auto-updated.

Last update: 2024-04-21 19:25:16 UTC


README

An slightly modified version of jeffrey way's laracasts/flash composer package to issue the flash notifications based on toastr js.

Installation

The package is available on composer. Available for laravel 5.1+

composer install leantony/laravel-flash

Once you have installed, you need to add the service provider to your app.php configuration. Like so;

Leantony\Flash\Providers\ServiceProvider::class

If you are using laravel 5.5+, the provider will be discovered automatically. No need to add it manually to app.php

Publishing assets

You'll need to publish the javascript so that you can add it to your blade view/layout. To do so, you can run this command;

php artisan vendor:publish --provider="Leantony\Flash\Providers\ServiceProvider" --tag="assets"

Make changes to your view/layout

Note that you'll need the toastr js asset loaded before the js provided by this package

<--- toastr js --->
<script src="{{ asset('vendor/leantony/flash/js/flash.js') }}"></script>

@include('leantony::flash.toast')

Usage

Same as laracasts/flash. Anytime you flash('some message'), depending on how you call the function, the alert you get should be a toastr notification.