我正在尝试在 Laravel 应用程序中显示 Google 日历。我可以使用这个包获取谷歌日历。
如何显示如下日历?
谢谢@Prisoner。我在控制器中使用了以下代码。
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Spatie\GoogleCalendar\Event;
use Calendar;
class HomeController extends BaseController
{
public function calendar() {
$events = [];
$data = Event::get();
if($data->count()){
foreach ($data as $key => $value) {
$events[] = Calendar::event(
$value->name,
true,
new \DateTime($value->startDate),
new \DateTime($value->endDate.' +1 day')
);
}
}
$calendar = Calendar::addEvents($events);
return view('welcome', compact('calendar'));
}
}
但我得到白屏。