/** * 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')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request) { $picture = Picture::findOrFail($id); $file1 = Input::file('image1'); $file2 = Input::file('image2'); $file3 = Input::file('image3'); $file4 = Input::file('image4'); $file5 = Input::file('image5'); $file6 = Input::file('image6'); $file7 = Input::file('image7'); $file8 = Input::file('image8'); $file9 = Input::file('image9'); if (Input::hasFile('image1')) { $fileName1 = $file1->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file1->move($path, $fileName1)) { $picture->image1 = $fileName1; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image2')) { $fileName2 = $file2->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file2->move($path, $fileName2)) { $picture->image2 = $fileName2; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image3')) { $fileName3 = $file3->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file3->move($path, $fileName3)) { $picture->image3 = $fileName3; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image4')) { $fileName4 = $file4->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file4->move($path, $fileName4)) { $picture->image4 = $fileName4; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image5')) { $fileName5 = $file5->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file5->move($path, $fileName5)) { $picture->image5 = $fileName5; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image6')) { $fileName6 = $file6->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file6->move($path, $fileName6)) { $picture->image6 = $fileName6; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image7')) { $fileName7 = $file7->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file7->move($path, $fileName7)) { $picture->image7 = $fileName7; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image8')) { $fileName8 = $file8->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file8->move($path, $fileName8)) { $picture->image8 = $fileName8; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } if (Input::hasFile('image9')) { $fileName9 = $file9->getClientOriginalName(); $path = base_path('../public_html/carousel'); if ($file9->move($path, $fileName9)) { $picture->image9 = $fileName9; $picture->save(); Session::flash('message', "Se ha mdificado el carrusel correctamente correctamente"); } } $user_id = Auth::user()->id; $user_role = User::findOrfail($user_id); return redirect()->route('admin.properties.show', compact('user_role')); }