Esempio n. 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(EditPropertyRequest $request, $id)
 {
     $property = Property::findOrFail($id);
     $property->fill($request->all());
     $property->save();
     if ($request->file('logo') !== null) {
         $property->removeLogo();
         PictureHelper::savePictures([$request->file('logo')], $property, "logo");
     }
     $message = $property->name . ' updated successfully';
     if ($request->ajax()) {
         return $message;
     }
     Session::flash('message', $message);
     session('current_property')->load('pictures');
     return redirect()->route('admin.property.index');
 }
Esempio n. 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(EditRoomTypeRequest $request, $id)
 {
     $roomtype = RoomType::findOrFail($id);
     $roomtype->fill($request->all());
     $roomtype->save();
     $pictures = $request->file('pictures');
     if ($pictures[0] !== null) {
         $roomtype->removePictures();
         PictureHelper::savePictures($pictures, $roomtype);
     }
     $message = $roomtype->name . ' updated successfully';
     if ($request->ajax()) {
         return $message;
     }
     Session::flash('message', $message);
     return redirect()->route('admin.room_types.index');
 }