1. Go to this page and download the library: Download bfg/livewire 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/ */
bfg / livewire example snippets
class MyComponent extends \Livewire\Component
{
...
public function submit() {
$this->emit('swal', [
'icon' => 'error',
'title' => 'Oops...',
'text' => 'Something went wrong!',
'footer' => '<a href="">Why do I have this issue?</a>'
]);
}
...
}
...
$this->emit('swal:confirm', [
'title' => 'Do you want to save the changes?',
'text' => 'Save changes',
'confirmEvent' => 'livewireEvent', // You livewire event
'confirmParams' => ['user_id' => 1], // You livewire event parameters
]);
...
...
$this->emit('swal:success', [
'title' => 'Changes saved!',
'text' => 'All you changes is saved'
]);
// Or
$this->emit('swal:success', [ // Can be: success, error, warning, info
'Changes saved!',
'All you changes is saved'
]);
...
...
$this->emit('toastr:success', 'Changes saved!');
$this->emit('toastr:success', [ // Can be: success, error, warning, info
'Changes saved!',
'All you changes is saved',
['timeOut' => 5000]
]);
...