lopatin96/laravel-alert

Laravel alert

Installs: 7 866

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:Blade

1.0.7 2024-02-20 13:51 UTC

This package is auto-updated.

Last update: 2024-12-20 15:26:36 UTC


README

Include alert component in resources/views/components/banner:

<x-laravel-alert::alert />

Add alert component to resources/views/layouts/app.blade.php:

<body class="font-sans antialiased">
    @include('laravel-subscription::subscription.info')
    
    <div class="min-h-screen bg-gray-100">
        @livewire('navigation-menu')
        <x-banner />

Display message in alert:

session(['flash.banner' => __('alerts.test')]);
// or
return redirect('dashboard')->with([
    'flash.banner' => __('alerts.test'),
    'flash.bannerStyle' => 'success',
]);

Set danger style to the banner:

session(['flash.bannerStyle' => 'danger']);
// or
session(['flash.bannerStyle' => 'success']);

Publishing

Views

php artisan vendor:publish --tag="laravel-alert-views"