A Bootstrap CSS alert helper for Laravel
You can install the package via composer:
composer require "ankurk91/laravel-alert"
Include the alert view within your view blade templates.
@include('alert::bootstrap')
You can use facade.
<?php
use Ankurk91\LaravelAlert\Facades\Alert;
Alert::error('Something went wrong.');
Alert::danger('I am same as error.');
Alert::success('Contact saved.');
Alert::warning('You are running late.');
Alert::info('Order dispatched.');
There is also a global helper function if you prefer.
<?php
alert()->info('Use anywhere without facade.');
alert('You can use the <b>html</b> tags like this too.', 'danger');
The package include the template to support bootstrap vue alert component.
Import the required javascript components.
// resources/js/bootstrap.js
import {AlertPlugin} from 'bootstrap-vue'
Vue.use(AlertPlugin)
Update your blade template like:
@include('alert::bootstrapVue')
Alpine.js support
Add alpine.js script to your blade template
# use a CDN or install via npm
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.8/dist/cdn.min.js"></script>
Update your blade template like:
@include('alert::bootstrapAlpine')
Please see CHANGELOG for more information what has changed recently.
composer test
If you discover any security issues, please email pro.ankurk1[at]gmail[dot]com
instead of using the issue tracker.
Original code taken from vinkla/laravel-alert
The MIT License.