set up list management
This commit is contained in:
parent
0c42bef077
commit
73d6578857
26 changed files with 495 additions and 230 deletions
33
app/Livewire/Forms/SettingsForm.php
Normal file
33
app/Livewire/Forms/SettingsForm.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue