/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $hard = Hardwareinventory::where('host_id', $id)->get()->first(); if ($hard != null) { Hardwareinventory::destroy($hard->id); } $host = Host::destroy($id); return redirect('hosts')->with('success_message', 'ホストを削除しました。'); }