PHP code example of theabhishekin / livewire-toast

1. Go to this page and download the library: Download theabhishekin/livewire-toast library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

theabhishekin / livewire-toast example snippets


// Simple toast
$this->dispatch('toast', [
    'title' => 'Event has been created.',
]);

// With description and type
$this->dispatch('toast', [
    'title' => 'Booking Updated',
    'description' => 'Your booking has been confirmed.',
    'type' => 'info', // default|success|error|warning|info|loading
]);

// With action button
$this->dispatch('toast', [
    'title' => 'Item deleted',
    'description' => 'You can undo this action.',
    'type' => 'success',
    'action' => [
        'label' => 'Undo',
        'url' => '/undo/123',
        // or: 'event' => 'toast-undo',
    ],
    'cancel' => [
        'label' => 'Dismiss',
    ],
]);

// Using the Toast helper
use TheAbhishekIN\LivewireToast\Toast;

Toast::info($this, 'Booking Updated', [
    'description' => 'Your booking has been confirmed.',
]);

Toast::success($this, 'Saved!');
Toast::error($this, 'Something went wrong.');
Toast::warning($this, 'Please review.');
Toast::loading($this, 'Processing...');
bash
php artisan vendor:publish --tag=livewire-toast-config