class Checklist extends Field
{
protected string $view = 'forms.components.checklist';
protected int $list;
protected Model $device;
protected function setUp(): void
{
parent::setUp();
}
public function list(int $list): static
{
$this->list = $list;
return $this;
}
public function getList(): int
{
return $this->list;
}
public function device($device)
{
$this->device = $device;
return $this;
}
public function getDevice()
{
return $this->device;
}
public function render(): View
{
$checklistItems = $this->getDevice()
->checklists()
->where('checklist_id', $this->getList())
->first()
->pivot
->items;
return view(
$this->getView(),
array_merge(
['attributes' => new ComponentAttributeBag()],
$this->extractPublicProperties(),
$this->extractPublicMethods(),
isset($this->viewIdentifier) ? [$this->viewIdentifier => $this] : [],
$checklistItems
),
);
}
}
class Checklist extends Field
{
protected string $view = 'forms.components.checklist';
protected int $list;
protected Model $device;
protected function setUp(): void
{
parent::setUp();
}
public function list(int $list): static
{
$this->list = $list;
return $this;
}
public function getList(): int
{
return $this->list;
}
public function device($device)
{
$this->device = $device;
return $this;
}
public function getDevice()
{
return $this->device;
}
public function render(): View
{
$checklistItems = $this->getDevice()
->checklists()
->where('checklist_id', $this->getList())
->first()
->pivot
->items;
return view(
$this->getView(),
array_merge(
['attributes' => new ComponentAttributeBag()],
$this->extractPublicProperties(),
$this->extractPublicMethods(),
isset($this->viewIdentifier) ? [$this->viewIdentifier => $this] : [],
$checklistItems
),
);
}
}