Back

/ 1 min read

Livewire Pull Method

Returns and resets a livewire property in one:

public $title = '';
public function add()
{
Post::create([
'title' => $this->title;
]);
$this->reset('title');
}

Now becomes:

public $title = '';
public function add()
{
Post::create([
'title' => $this->pull('title');
])
}