/** * 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'); } } }
/** * 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 = base_path('../public_html/uploads'); $bedroom = new Bedroom($request->all()); $bedroom->image = $fileName; if ($file->move($path, $fileName)) { $bedroom->save(); Session::flash('message', "El cuarto fue agregado correctamente"); return redirect()->route('admin.properties.show'); } } }