PHP code example of nawasara / toaster

1. Go to this page and download the library: Download nawasara/toaster 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/ */

    

nawasara / toaster example snippets


session()->flash('toast', [
    'type' => 'success',
    'message' => 'Saved successfully',
]);

return redirect()->back();

use Livewire\Component;
use Nawasara\Toaster\Concerns\HasToaster;

class MyComponent extends Component
{
    use HasToaster;

    public function save()
    {
        // …
        $this->alert('success', 'Saved successfully');
    }
}