/**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  App\RoomType $roomType
  * @return Response
  */
 public function update(Request $request, RoomType $roomType)
 {
     $this->validate($request, ['name' => 'required|unique:room_types,name,' . $roomType->id, 'capacity' => 'required|numeric', 'price' => 'required|numeric', 'description' => 'required', 'image' => 'image', 'facilities' => '']);
     $input = $request->except('image', 'facilities');
     $input['slug'] = str_slug($input['name']);
     $image = $request->file('image');
     if (!empty($image)) {
         Storage::delete($roomType['image_path']);
         $imageName = str_slug($input['name']);
         $extension = $image->getClientOriginalExtension();
         Storage::disk('local')->put($imageName . '.' . $extension, File::get($image));
         $input['image_path'] = $imageName . '.' . $extension;
     }
     $roomType->fill($input)->save();
     RoomFacility::where('room_type_id', $roomType->id)->delete();
     $facilities = $request->input('facilities');
     foreach ($facilities as $facility) {
         $roomFacility['room_type_id'] = $roomType->id;
         $roomFacility['facility_id'] = $facility;
         RoomFacility::create($roomFacility);
     }
     return redirect('/type');
 }