I’d like to have a select where someone can change a setting (without a save button). If I’m correct this can be done with model property binding in v2, but I can’t get it to work.
view:
<select wire:model="post.is_public">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
component:
class Test extends Component
{
public $post;
protected $rules = [
'post.is_public' => 'boolean'
];
public function render()
{
$this->post->save();
// session()->flash('saved', true);
return view('livewire.public-toggle');
}
}
I have commented out the session part, but I’d like this to be included eventually so I can display message to the user that this was saved.