<?php

namespace App\Traits\Outlet;

trait WithFacilityHandler
{
    public function addFacility(): void
    {
        $this->form->facilities[] = '';
    }

    public function removeFacility(int $index): void
    {
        unset($this->form->facilities[$index]);
        $this->form->facilities = array_values($this->form->facilities);

        if (empty($this->form->facilities)) {
            $this->form->facilities = [''];
        }
    }
}
