PHP code example of arturgrigio / google-laravel-calendar-2
1. Go to this page and download the library: Download arturgrigio/google-laravel-calendar-2 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
arturgrigio / google-laravel-calendar-2 example snippets
use Arturgrigio\GoogleCalendar\Event;
//create a new event
$event = new Event;
$event->name = 'A new event';
$event->startDateTime = Carbon\Carbon::now();
$event->endDateTime = Carbon\Carbon::now()->addHour();
$event->save();
// get all future events on a calendar
$events = Event::get();
$firstEvent = $events->first();
$firstEvent->name = 'updated name';
$firstEvent->save();
// create a new event
Event::create([
'name' => 'A new event'
'startDateTime' => Carbon\Carbon::now(),
'endDateTime' => Carbon\Carbon::now()->addHour(),
]);
// delete an event
$event->delete();
$event = new Event;
$event->name = 'A new event';
$event->startDateTime = Carbon\Carbon::now();
$event->endDateTime = Carbon\Carbon::now()->addHour();
$event->save();
Event::create([
'name' => 'A new event',
'startDateTime' => Carbon\Carbon::now(),
'endDateTime' => Carbon\Carbon::now()->addHour(),
]);
$event = new Event;
$event->name = 'A new full day event';
$event->startDate = Carbon\Carbon::now();
$event->endDate = Carbon\Carbon::now()->addDay();
$event->save();
// get the id of the first upcoming event in the calendar.
$calendarId = Event::get()->first()->id;