aleksandro-del-piero / livewire-locked-properties
Livewire locked properties
1.0.0
2023-12-11 02:16 UTC
Requires (Dev)
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2024-09-12 01:52:31 UTC
README
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.