Fix Maintenance Creation

This commit is contained in:
Jonatan Rek 2024-08-06 17:02:14 +02:00
parent e166932809
commit 13756de3a8

View File

@ -62,6 +62,13 @@ public function store()
$hosts = Host::whereIn('id', $this->hosts)->get();
foreach ($hosts as $key => $host) {
$maintenance->hosts()->attach($host);
$tasks = Host::whereIn('id', $this->hosts_tasks[$host->id])->get();
foreach ($tasks as $task) {
$maintenance->tasks()->create([
'task_id' => $task->id,
'host_id' => $host->id,
]);
}
}
$this->dispatch('closeModal');
}