createFromGoogleCalendarEvent() public static method

public static createFromGoogleCalendarEvent ( Google_Service_Calendar_Event $googleEvent, $calendarId )
$googleEvent Google_Service_Calendar_Event
Example #1
0
 /**
  * @param \Carbon\Carbon|null $startDateTime
  * @param \Carbon\Carbon|null $endDateTime
  * @param array               $queryParameters
  * @param string|null         $calendarId
  *
  * @return \Illuminate\Support\Collection
  */
 public static function get(Carbon $startDateTime = null, Carbon $endDateTime = null, array $queryParameters = [], string $calendarId = null) : Collection
 {
     $googleCalendar = static::getGoogleCalendar($calendarId);
     $googleEvents = $googleCalendar->listEvents($startDateTime, $endDateTime, $queryParameters);
     return collect($googleEvents)->map(function (Google_Service_Calendar_Event $event) use($calendarId) {
         return Event::createFromGoogleCalendarEvent($event, $calendarId);
     })->sortBy(function (Event $event) {
         return $event->sortDate;
     })->values();
 }