我正在使用spatie/laravel-google-calendar
包创建有会议的事件,但它只创建没有会议的事件,我合并了这个提交
但它没有工作'仍然创建没有会议的事件'。
这是文件的createFromGoogleCalendarEvent
方法event.php
public static function createFromGoogleCalendarEvent(Google_Service_Calendar_Event $googleEvent, $calendarId)
{
// this option are to create a conference and add a link to meet in event
$googleCalendar = static::getGoogleCalendar($calendarId);
$service = $googleCalendar->getService();
$conference = new \Google_Service_Calendar_ConferenceData();
$conferenceRequest = new \Google_Service_Calendar_CreateConferenceRequest();
$conferenceRequest->setRequestId('randomString123');
$conference->setCreateRequest($conferenceRequest);
$googleEvent->setConferenceData($conference);
$googleEvent = $service->events->patch($calendarId, $googleEvent->id, $googleEvent, ['conferenceDataVersion' => 1]);
$event = new static;
$event->googleEvent = $googleEvent;
$event->calendarId = $calendarId;
return $event;
}
这是我创建事件的代码
$event = new Spatie\GoogleCalendar\Event;
$event->name = 'A new event';
$event->description = 'Event description';
$event->startDateTime = Carbon\Carbon::now();
$event->endDateTime = Carbon\Carbon::now()->addHour();
$event->save();
这是我的回应
{
anyoneCanAddSelf: null,
attendeesOmitted: null,
colorId: null,
created: "2021-04-06T11:54:35.000Z",
description: "Event description",
endTimeUnspecified: null,
etag: ""3235420151680000"",
eventType: "default",
guestsCanInviteOthers: null,
guestsCanModify: null,
guestsCanSeeOtherGuests: null,
hangoutLink: null,
htmlLink: "https://www.google.com/calendar/event?eid=dXZyNHByamc0ZXNqbDkxajI5c3I0cWI3c28gZGxvcW45M2VoOWlsZm5lOWRjb2xodDY5aWtAZw",
iCalUID: "uvr4prjg4esjl91j29sr4qb7so@google.com",
id: "uvr4prjg4esjl91j29sr4qb7so",
kind: "calendar#event",
location: null,
locked: null,
privateCopy: null,
recurrence: null,
recurringEventId: null,
sequence: 0,
status: "confirmed",
summary: "A new event",
transparency: null,
updated: "2021-04-06T11:54:35.840Z",
visibility: null,
creator: {
displayName: null,
email: "mohamed-service-account@mohamed-project.iam.gserviceaccount.com",
id: null,
self: null
},
organizer: {
displayName: "Mohamed calendar",
email: "dloqn93eh9ilfne9dcolht69ik@group.calendar.google.com",
id: null,
self: true
},
start: {
date: null,
dateTime: "2021-04-06T13:54:35+02:00",
timeZone: null
},
end: {
date: null,
dateTime: "2021-04-06T14:54:35+02:00",
timeZone: null
},
reminders: {
useDefault: true
}
}