Dynamic Laravel Livewire Bootstrap toasts.

Overview

Laravel Livewire Toasts

This package allows you to dynamically show Bootstrap toasts via Laravel Livewire components.

Documentation

Requirements

  • Bootstrap 5 must be installed via webpack first

Installation

Require the package:

composer require bastinald/laravel-livewire-toasts

Add the livewire:toasts component to your app layout view:

<livewire:toasts/>
<livewire:scripts/>
<script src="{{ asset('js/app.js') }}"></script>

Require ../../vendor/bastinald/laravel-livewire-toasts/resources/js/toasts in your app javascript file:

require('@popperjs/core');
require('bootstrap');
require('../../vendor/bastinald/laravel-livewire-toasts/resources/js/toasts');

Usage

Showing Toasts

Show a toast by emitting the showToast event with the color & message:

public function save()
{
    $validated = $this->validate();

    $this->user->fill(array_filter($validated))->save();

    $this->emit('showToast', 'success', __('User Saved!'));
}

The color should be a Bootstrap color name .e.g success, danger, info.

Emitting Events

You can emit events inside your views:

<button type="button" wire:click="$emit('showToast', 'danger', 'Closing!')">
    {{ __('Close') }}
</button>

Or inside your components, just like any normal Livewire event:

public function save()
{
    $this->validate();

    // save the record

    $this->emit('showToast', 'info', __('Record Saved!'));
}

Publishing Assets

Custom Config

Customize the toasts configuration by publishing the config file:

php artisan vendor:publish --tag=laravel-livewire-toasts:config

Now you can easily change things like the hide delay and error message.

Custom View

Use your own toasts view by publishing the view file:

php artisan vendor:publish --tag=laravel-livewire-toasts:views

Now edit the view file inside resources/views/vendor/laravel-livewire-toasts. The package will use this view to render the component.

You might also like...
This package provides a console command to convert dynamic JS/CSS to static JS/CSS assets.
This package provides a console command to convert dynamic JS/CSS to static JS/CSS assets.

Laravel Nova Search This package provides a console command to convert dynamic JS/CSS to static JS/CSS assets. Requirements laravel-mix v6.0+ php 7.3+

Jumpstart your web development journey with the HALT Stack Starter Kit, a one-command solution for creating dynamic, scalable, and clean web applications.

Welcome to the HALT Stack Starter Kit! This kit is designed to help you kickstart your web development projects using the HALT Stack, a powerful combi

A TALL (Tailwind CSS, Alpine.js, Laravel and Livewire) Preset for Laravel
A TALL (Tailwind CSS, Alpine.js, Laravel and Livewire) Preset for Laravel

Laravel TALL Preset A front-end preset for Laravel to scaffold an application using the TALL stack, jumpstarting your application's development. If yo

Laravel Livewire Excel Upload with Progressbar

Laravel Livewire Excel Upload with Progressbar This is sample project, that explains how to import Excel files with progress bar Steps to run project

 Belich Tables: a datatable package for Laravel Livewire
Belich Tables: a datatable package for Laravel Livewire

Belich Tables is a Laravel package base on Livewire and AlpineJS that allows you to create scaffold datatables with search, column sort, filters, pagination, etc...

Laravel Livewire full page component routing.

Laravel Livewire Routes Laravel Livewire full page component routing. This package allows you to specify routes directly inside your full page Livewir

Auto generate routes for Laravel Livewire components

livewire-auto-routes Auto generate routes for Laravel Livewire Components. Requirements Livewire 2 Laravel 8 php 8 Installation composer require tanth

Laravel Livewire UI, Auth, & CRUD starter kit.
Laravel Livewire UI, Auth, & CRUD starter kit.

Laravel Livewire Ui This package provides Laravel Livewire & Bootstrap UI, Auth, & CRUD scaffolding commands to make your development speeds blazing f

Laravel 8 + CoreUI + Livewire + Datatables (CRUD)

Laravel 8 + CoreUI + Livewire + Datatables About Laravel 8 + CoreUI + Livewire Datatables Whats Inside Laravel Core UI - (https://github.com/HZ-HBO-IC

Owner
null
A laravel Livewire Dynamic Selects with multiple selects depending on each other values, with infinite levels and totally configurable.

Livewire Combobox: A dynamic selects for Laravel Livewire A Laravel Livewire multiple selects depending on each other values, with infinite levels of

Damián Aguilar 25 Oct 30, 2022
A dynamic table component for Laravel Livewire - For Slack access, visit:

A dynamic Laravel Livewire component for data tables. Bootstrap 4 Demo | Bootstrap 5 Demo | Tailwind Demo | Demo Repository Installation You can insta

Anthony Rappa 1.3k Jan 1, 2023
A dynamic Laravel Livewire component for multi steps form

Livewire component that provides you with a wizard that supports multiple steps form while maintaining state.

Vildan Bina 233 Jan 4, 2023
Laravel-comments-livewire - Livewire components for the laravel-comments package

Associate comments and reactions with Eloquent models This package contains Livewire components to be used with the spatie/laravel-comments package. S

Spatie 15 Jan 18, 2022
Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.

Laravel Livewire Forms Laravel Livewire form component with declarative Bootstrap 5 fields and buttons. Requirements Bootstrap 5 Installation composer

null 49 Oct 29, 2022
Laravel UI, Auth, & CRUD scaffolding package using Bootstrap & Livewire.

bastinald/ux Laravel UI, Auth, & CRUD scaffolding package using Bootstrap & Livewire. Features Automatic migrations Automatic routing Automatic passwo

null 33 Nov 26, 2022
Sweetalert and Toaster notifications for Laravel livewire with support for tailwind and bootstrap.

Larabell Integrate livewire with sweetalert. Installation How to use Sweetalert Toast Available configuration Installation composer require simtabi/la

Simtabi 3 Jul 27, 2022
Free and open-source Laravel admin dashboard interface built with Livewire & Alpine.js based on Bootstrap 5

Volt Dashboard Laravel Free Frontend Web App for Laravel with Livewire & Alpine.js Never start a development project from scratch again. We've partner

Themesberg 200 Jan 4, 2023
A Laravel starter kit with auth scaffolding using Livewire & Bootstrap.

Zephyr This package is a Laravel starter kit with auth scaffolding using Livewire & Bootstrap. It was created for people who prefer using Livewire & B

null 23 Aug 26, 2022
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Livewire 17.7k Jan 1, 2023