PHP code example of oskar-mikael / livewire-dirty-state
1. Go to this page and download the library: Download oskar-mikael/livewire-dirty-state 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/ */
oskar-mikael / livewire-dirty-state example snippets
namespace App\Livewire;
use Livewire\Component;
use OskarMikael\LivewireDirtyState\WithDirtyState;
class TestComponent extends Component
{
use WithDirtyState;
public string $name;
public string $email;
public function render()
{
return view('livewire.test-component');
}
}
// Set state to dirty
$this->setDirty()
// Remove dirty state
$this->setDirty(false)
#[IgnoreDirtyState]
public string $name;
bash
php vendor/bin/phpunit