/** * Register the application services. */ public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/laravel-google-calendar.php', 'laravel-google-calendar'); $this->app->bind(GoogleCalendar::class, function () { $calendarId = config('laravel-google-calendar.calendar_id'); return GoogleCalendarFactory::createForCalendarId($calendarId); }); $this->app->alias(GoogleCalendar::class, 'laravel-google-calendar'); }
/** * @param string $calendarId * * @return \Spatie\GoogleCalendar\GoogleCalendar */ protected static function getGoogleCalendar($calendarId = null) { $calendarId = $calendarId ?? config('laravel-google-calendar.calendar_id'); return GoogleCalendarFactory::createForCalendarId($calendarId); }