/** * Store a newly created resource in storage. * * @return Response */ public function store(CreateBedRoomRequest $request) { $file = Input::file('image'); if (Input::hasFile('image')) { $fileName = $file->getClientOriginalName(); $path = public_path() . '\\uploads\\'; $bedroom = new Bedroom($request->all()); $bedroom->image = $fileName; if ($file->move($path, $fileName)) { $bedroom->save(); return redirect()->route('admin.properties.index'); } } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show() { $user_id = Auth::user()->id; $user_role = User::findOrfail($user_id); $properties = Property::select('id', 'name', 'image', 'status', 'num_bedrooms', 'description', '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(); $roomsA = Bedroom::select('id', 'property_id', 'status')->where('bedrooms.property_id', '=', 'property.id')->get(); return view('admin.properties.show', compact('properties', 'service', 'state', 'city', 'property_type', 'user', 'user_role')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Redirector $redirector) { $user_id = Auth::user()->id; $user_role = User::findOrfail($user_id); $bedroom = Bedroom::findOrFail($id); $bedroom->delete(); return view('admin.control.admin', compact('user_role')); }