Example #1
0
 /**
  * Updates an event by the specified API ID.
  *
  * @param string $api_id
  *
  * @return bool
  */
 public function updateByApiId($api_id)
 {
     $data = $this->input;
     if ($this->getInput('location_id')) {
         $location = $this->location->find($this->getInput('location_id'));
         /*
          * Were stripping the tags from the trial because it contains HTML formatting,
          * and google does not display such formatting on their calendar
          */
         $data['location'] = strip_tags($location->trail);
     }
     return $this->eventApi->setInput($data)->update($api_id);
 }
 /**
  * Updates an event.
  *
  * @param Request    $request
  * @param int|string $id
  *
  * @return bool|Event
  */
 public function update(Request $request, $id)
 {
     $event = $this->find($id);
     if ($event) {
         if ($request->has('location_id')) {
             $location = $this->location->model()->find($request->input('location_id'));
             if ($location) {
                 $request->location = strip_tags($location->trail);
             }
         }
         $apiEvent = $this->eventApi->setInput($request->all())->update($event->api_id);
         if ($apiEvent) {
             return $event;
         }
     }
     return false;
 }