示例#1
0
 /**
  * Returns a parsed array of API event entries for FullCalendar.
  *
  * @param BetweenRequest $request
  *
  * @return array
  */
 public function between(BetweenRequest $request)
 {
     $filter = ['timeMin' => strToRfc3339($request->input('start')), 'timeMax' => strToRfc3339($request->input('end'))];
     return $this->event->parseEvents($this->event->getApiEvents($filter));
 }
示例#2
0
 /**
  * Returns the events recurrences by it's Api ID.
  *
  * @param int|string $id
  *
  * @return mixed
  */
 public function getRecurrencesByApiId($id)
 {
     $filter = ['timeMin' => strToRfc3339(strtotime('now')), 'timeMax' => strToRfc3339(strtotime('+1 month'))];
     return $this->eventApi->setInput($filter)->getRecurrences($id);
 }
 /**
  * Updates the specified google calendar event.
  *
  * @param string $id
  *
  * @return bool
  */
 public function update($id)
 {
     $event = $this->find($id);
     if ($event) {
         /*
          * Convert the rule array to RRULE string
          */
         $rrule = $this->arrayToRRule($this->getArrayRules());
         /*
          * Combine dates with their times
          */
         $start = $this->getInput('start_date') . ' ' . $this->getInput('start_time');
         $end = $this->getInput('end_date') . ' ' . $this->getInput('end_time');
         $allDay = $this->getInput('all_day');
         /*
          * Values set to events default
          */
         $event->title = $this->getInput('title', $event->apiObject->getSummary());
         $event->description = $this->getInput('description', $event->apiObject->getDescription());
         $event->location = $this->getInput('location', $event->apiObject->getLocation());
         $event->start = strToRfc3339($start, $allDay);
         $event->end = strToRfc3339($end, $allDay, true);
         $event->allDay = $allDay;
         $event->rrule = $rrule;
         return $this->calendar->updateEvent($event);
     }
     return false;
 }