public function attach()
 {
     $images = Request::input('images');
     $gallery = Request::input('gallery');
     foreach ($images as $image) {
         $galleryObj = Gallery::find($gallery);
         $galleryObj->images()->save(ImageList::find($image));
         $galleryObj->save();
     }
     return "success";
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //
     $gallery = Gallery::find($id);
     // TODO: Smarter stuff
     $gallery->update(Request::all());
     $gallery->slug = preg_replace("/[^a-zA-Z0-9 ]+/", "", $gallery->name);
     $gallery->slug = str_replace(' ', '-', $gallery->slug);
     $gallery->slug = strtolower($gallery->slug);
     $gallery->save();
     if (Request::has('show')) {
         $locationGallery = LocationGallery::where('gallery_id', '=', $id)->where('location_id', '=', Location::current()->id)->first();
         $locationGallery->show = filter_var(Request::input('show'), FILTER_VALIDATE_BOOLEAN);
         $locationGallery->save();
     }
     return $gallery;
 }