movie-night-nuevo/app/Livewire/Forms/SettingsForm.php

34 lines
693 B
PHP
Raw Normal View History

2025-12-13 19:33:52 -06:00
<?php
namespace App\Livewire\Forms;
use App\Models\MovieList;
use Livewire\Attributes\Locked;
use Livewire\Form;
class SettingsForm extends Form
{
#[Locked]
public ?int $listId = null;
public bool $isPublic = false;
public string $name = "";
public function setList(MovieList $list): void
{
$this->name = $list->name;
$this->listId = $list->id;
$this->isPublic = $list->is_public;
}
public function save(): void
{
if ($this->listId) {
$list = MovieList::find($this->listId);
$list->name = $this->name;
$list->is_public = $this->isPublic;
$list->save();
}
}
}