/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PostRoomsRequest $request)
 {
     $room = new Room();
     $price = $request->get('price');
     $room->price = Room::preg_check($price);
     $room->share_basis = $request->get('share_basis');
     $room->available = $request->get('date');
     $room->bedroom = $request->get('bedrooms');
     $room->bathrooms = $request->get('bathrooms');
     $room->smoking = $request->get('smoking');
     $room->furnished = $request->get('furnished');
     $room->parking = $request->get('parking');
     $room->pet_friendly = $request->get('pet_friendly');
     $room->gender_friendly = $request->get('gender_friendly');
     $room->title = $request->get('title');
     $room->description = $request->get('description');
     $room->name = $request->get('name');
     $room->phone = $request->get('phone');
     $room->address = $request->get('address');
     $result = array();
     if (Input::has('photo')) {
         $photo = Input::file('photo');
         $photoSize = $photo->getsize();
         if ($photoSize > $_ENV['max_file_size']) {
             $results = array('size' => $photoSize, 'name' => $filename = time() . '-' . $photo->getClientOriginalName(), 'photoSizedError' => 'File size can not be more than ' . $_ENV['max_file_size'] / 1000000 . 'mb');
         } else {
             //Renaming file name and saving.
             $filename = time() . '-' . $photo->getClientOriginalName();
             $destination = public_path() . '/img/' . $filename;
             if (!File::exists($destination)) {
                 try {
                     $photo_path = $photo->move(public_path() . '/img/', $filename, 100);
                     $room->urls = $filename;
                 } catch (Fileexception $e) {
                     return 'Sorry, Could not upload the file! Please, try again later!!';
                 }
             } else {
                 return 'This File already exist!! Please, upload another file!!!';
             }
         }
     }
     if ($room->save()) {
         return redirect('rooms')->with('flash_message', 'Your posting has been completed successfully');
     }
 }