public function show($id) { $travel = Travel::where('ID_Travel', '=', $id)->firstOrFail(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); $package = TravelPackage::where('ID_Travel', '=', $id)->get(); return View::make('travels.show', compact('travel'))->with('package', $package)->with('data', $data); }
File::delete($filename); } $urlNew = $updatePackage["new"]["image"]; $requestNew = Request::create($urlNew); $nameNew = $requestNew->segments(); $nameNew = $nameNew[count($nameNew) - 1]; $fileNew = file_get_contents($urlNew); file_put_contents("resources/images/integration/int_travel/" . $nameNew, $fileNew); $newPackage = ["Package_Name" => $updatePackage["new"]["name"], "Package_Picture" => $nameNew, "Package_Description" => $updatePackage["new"]["details"], "Package_Price" => $updatePackage["new"]["price"]]; $package->update($newPackage); } }); Route::POST('/DeletePaketWisata', function () { $getTravelPackage = Input::json()->all(); $deletePackage = ["Package_Name" => $getTravelPackage["paket"]["name"], "Package_Price" => $getTravelPackage["paket"]["price"], "Package_Picture" => $getTravelPackage["picture"]]; $package = TravelPackage::where("Package_Name", "=", $deletePackage['Package_Name'])->where("Package_Price", "=", $deletePackage['Package_Price']); $name = $package->get()->first()->Package_Picture; $filename = 'resources/images/integration/int_travel/' . $name; if ($package->count() == 1) { //Destination::where("ID_Travel_Package",'=',$package->get(["ID_Travel_Package"])->first()->ID_Travel_Package; if (File::exists($filename)) { File::delete($filename); } $package->delete(); } else { for ($i = 0; $i < $package->count(); $i++) { if (File::exists($filename)) { File::delete($filename); } $package->delete(); }