bfg/puller-livewire

A description for puller-livewire.

1.0.0 2022-01-01 19:06 UTC

This package is auto-updated.

Last update: 2024-10-29 06:19:18 UTC


README

Software License Total Downloads

Install

composer require bfg/puller-livewire

This package is a plug-in for Puller.

Navigate the link to read the documentation in the https://github.com/bfg-s/puller.

Usage

Make sure that in your public/vendor folder published puller-livewire/puller-livewire.js. He had to appear immediately after installing the package, as it broads publications in the laravel-assets group. If this did not happen and you did not appear there, publish it manually:

php artisan vendor:publish --tag=puller-livewire-assets

Connect the script in your document after Livewire initialization:

@livewireScripts()
<script src="{{ asset('vendor/puller-livewire/puller-livewire.js') }}"></script>

In Livewire component make event:

class OrderTracker extends Component
{
    public $showNewOrderNotification = false;
 
    // Special Syntax: ['puller:{event}' => '{method}']
    protected $listeners = ['puller:livewire_event_name' => 'notifyNewOrder'];
 
    public function notifyNewOrder()
    {
        $this->showNewOrderNotification = true;
    }
}

Send Create a guide class or an anonymous channel named livewire_event_name.

Changelog

Please see CHANGELOG for more information what has changed recently.

Credits

Security

If you discover any security-related issues, please email xsaven@gmail.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.