Skip to content

aleksandro-del-piero/livewire-locked-properties

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Livewire locked properties for Livewire v. 2

The package allows you to designate component properties as locked.

Tested package on Livewire v2.12.6

Installation

You can install the package via composer:

composer require aleksandro_del_piero/livewire-locked-properties

Documentation

You need to add a trait to the component AleksandroDelPiero\LivewireLockedProperties\Traits\WithLockedLivewire;

To designate a property as protected, you must add it to a protected property $locked or declare a method locked().

namespace App\Http\Livewire;

use Livewire\Component;
use AleksandroDelPiero\LivewireLockedProperties\Traits\WithLockedLivewire;

class TestLivewire extends Component
{
    use WithLockedLivewire;

    public $name;

    protected $locked = [
        'name'
    ];
...

or a protected method 'locked'

namespace App\Http\Livewire;

use Livewire\Component;
use AleksandroDelPiero\LivewireLockedProperties\Traits\WithLockedLivewire;

class TestLivewire extends Component
{
    use WithLockedLivewire;

    public $name;

    protected function locked(): array
    {
        return ['name'];
    }
...

If a component has both a method and a property, the method will take precedence.

License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages