Fix Maintenance Creation
This commit is contained in:
parent
e166932809
commit
13756de3a8
@ -62,6 +62,13 @@ public function store()
|
|||||||
$hosts = Host::whereIn('id', $this->hosts)->get();
|
$hosts = Host::whereIn('id', $this->hosts)->get();
|
||||||
foreach ($hosts as $key => $host) {
|
foreach ($hosts as $key => $host) {
|
||||||
$maintenance->hosts()->attach($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');
|
$this->dispatch('closeModal');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user