Skip to content

Dynamic Google Calendar ID #296

Answered by bopismaster1
bopismaster1 asked this question in Q&A
Discussion options

You must be logged in to vote

I found a workaround on this, for create event
go to "vendor\spatie\laravel-google-calendar\src\Event.php"
got to line 61 (Create Function)
add calendar_id as params
change $event->calendarId = static::getGoogleCalendar($calendarId)->getCalendarId();

to

$event->calendarId=$calendar_id;

in short

public static function create(array $properties, string $calendarId = null, $optParams = [],$calendar_id=null)
{
$event = new static;

    // $event->calendarId = static::getGoogleCalendar($calendarId)->getCalendarId();
    $event->calendarId=$calendar_id;
    foreach ($properties as $name => $value) {
        $event->$name = $value;
    }

    return $event->save('insertEvent', $optParams);
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chazkame
Comment options

Answer selected by bopismaster1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants