A Laravel Livewire library to help you integrate SweetAlert and Toasts on yor applications.
composer require simtabi/larabell
...
\Simtabi\Larabell\LarabellServiceProvider::class
...
...
// place this directive in the header
@larabellCss
// no need to call this, as it has already been called when you call @larabellScripts
@larabellInit
...
Publish the configs: php artisan vendor:publish --tag=larabell:assets
.
Publish the configs: php artisan vendor:publish --tag=larabell:config
.
Publish the configs: php artisan vendor:publish --tag=larabell:views
.
To make it easy to build toasts and sweetalerts, we have implemented chained methods to help you with building
In your component add Toast
trait. Then call toast
method whenever you want.
use Simtabi\Larabell\HasLarabell;
use Livewire\Component;
class MyComponent extends Component
{
use HasLarabell;
public function save() {
$this->fireSwalNotification();
}
}
sweetalert parameters:
- title
- icon: success, error, warning, info, question - default is info
- timeout: in milliseconds, default is 5000
This is the normal sweetalert modal. In your component add Fire
trait. Then call fire
method whenever you want.
use Simtabi\Larabell\HasLarabell;
use Livewire\Component;
class MyComponent extends Component
{
use HasLarabell;
public function save() {
$this->fireToastNotification();
}
}
toast parameters:
Refer to the documentation online at: https://github.com/kamranahmedse/jquery-toast-plugin