PHP code example of fridaycollective / laravel-googlecalendar
1. Go to this page and download the library: Download fridaycollective/laravel-googlecalendar 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/ */
fridaycollective / laravel-googlecalendar example snippets
Route::get('/oauth/gmail', function (){
return LaravelGmail::redirect();
});
Route::get('/oauth/gmail/callback', function (){
LaravelGmail::makeToken();
return redirect()->to('/');
});
Route::get('/oauth/gmail/logout', function (){
LaravelGmail::logout(); //It returns exception if fails
return redirect()->to('/');
});
$messages = LaravelGmail::message()->subject('test')->unread()->preload()->all();
foreach ( $messages as $message ) {
$body = $message->getHtmlBody();
$subject = $message->getSubject();
}
php
'providers' => [
FridayCollective\LaravelGoogleCalendar\LaravelGmailServiceProvider::class,
]
php
'aliases' => [
'LaravelGmail' => FridayCollective\LaravelGoogleCalendar\Facade\LaravelGmail::class,
]
php
LaravelGmail::message()
->from('[email protected]')
->unread()
->in('TRASH')
->hasAttachment()
->all()
php
LaravelGmail::message()
->from('[email protected]')
->unread()
->in('TRASH')
->hasAttachment()
->preload()
->all()