afoysal
1 month ago
329
6
Laravel

Blank white screen in Google Calender

Posted 1 month ago by afoysal

I am trying to display Google Calendar in Laravel application. I can fetch Google Calendar using this package.

My controller code is like below

<?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);

        //dd($calendar);

        return view('welcome', compact('calendar'));
    }
}

If I dd() I can get below data.

enter image description here

My view files code is like below

<!doctype html>
<html lang="en">

<head>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.js"></script>
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.css" />
</head>

<body>
    {!! $calendar->calendar() !!}
    {!! $calendar->script() !!}
</body>

</html>

But I am getting white blank screen.

I used below codes in public/index.php file.

error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set("display_errors", 1);

But I am not getting any error.

There is no error in storage/laravel.log file also.

I am getting below situation when I go to console.

enter image description here

Please sign in or create an account to participate in this conversation.