Exemple #1
0
 /**
  * Update the specified resource in storage.
  * PUT /location/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $location = $this->locationRepository->findById($id);
     $the_location_id = $location['location_id'];
     $images = $this->locationRepository->getLocationImages($the_location_id);
     $url = $location['url'];
     $location->location_id = $the_location_id;
     if (isset($url)) {
         $location->url = $url;
     }
     $manager = new LocationManager($location, Input::all());
     $count = 0;
     foreach (Input::file('image') as $file) {
         $rules = array('file' => 'required');
         //'required|mimes:png,gif,jpeg,txt,pdf,doc'
         $validator = Validator::make(array('file' => $file), $rules);
         if ($validator->passes()) {
             $timer = Carbon\Carbon::now();
             $location_images = $this->imageRepository->getModel();
             $destinationPath = \Config::get('app.image.location-path-server');
             $filename = rand() . '.' . $file->getClientOriginalExtension();
             $upload_success = $file->move($destinationPath, $filename);
             $location_images->location_id = $the_location_id;
             $location_images->image_id = $filename;
             $location_images->save();
         }
     }
     $manager->save();
     return Redirect::route('location')->with('successMessage', 'El punto interactivo se ha editado con éxito.');
 }
Exemple #2
0
 public function ranking()
 {
     $ranking = $this->rankingRepository->getModel();
     $manager = new RankingManager($ranking, Input::all());
     $manager->save();
     $location = $this->locationRepository->findById(input::get('location_id'));
     $manager = new LocationManager($location, Input::all(), 'ranking');
     $manager->save();
     return Response::json(['success' => true]);
 }