/** * Display a listing of the resource. * * @return Response */ public function vistapropiedad(Request $request) { $property_id = $request->input('property_id'); $properties = Property::select('id', 'name', 'image', 'status', 'num_bedrooms', 'description', 'slogan', 'country_id', 'service_id', 'state_id', 'city_id', 'property_type_id', 'user_id')->with('country')->with('service')->with('state')->with('city')->with('property_type')->with('user')->orderBy('name', 'ASC')->get(); $amenities = Amenity::select('amenity', 'category')->where('property_id', '=', $property_id)->where('category', '=', "Special amenities")->get(); $service_a = Amenity::select('amenity', 'category')->where('property_id', '=', $property_id)->where('category', '=', "services")->get(); $technology_a = Amenity::select('amenity', 'category')->where('property_id', '=', $property_id)->where('category', '=', "technology")->get(); $pictures = Picture::select('image1', 'image2', 'image3', 'image4', 'image5', 'image6', 'image7', 'image8', 'image9')->where('property_id', '=', $property_id)->get(); $files = File::select('activities')->where('property_id', '=', $property_id)->get(); return view('vistapropiedad', compact('properties', 'property_id', 'service', 'state', 'city', 'property_type', 'user', 'user_role', 'amenity', 'slogan', 'amenities', 'amenity', 'service_a', 'technology_a', 'pictures', 'files')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Redirector $redirector) { $amenity = Amenity::findOrfail($id); $amenity->delete(); return $redirector->back(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Request $request) { $amenity = Amenity::findOrfail($id); $amenity->delete(); if ($request->ajax()) { return response()->json(['id' => $amenity = Amenity::findOrfail($id)]); } }