dimanche 25 février 2018

How to feed data in fullcalendar with laravel

I'm trying to feed the fullcalendar event property with json data from controller but is is not showing in the calendar, and I think I'm doing it well, but it's not. Please see my code below:

Controller

public function getCalendar(){
    $allBookings = Booking::with('itemsBooked')->get();
    $bookings = json_encode($allBookings);

    return view('admin.calendar.index', compact('bookings'));
}

view

<div id="jCalendar"></div>

Fullcalendar setup

$(document).ready(function(){
    $('#jCalendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        events: '',
        timezone: 'UTC',
        theme: true,
        themeSystem:'bootstrap3'
    })
});

Note: The fullcalendar setup is located at the bottom of the view, so I can use the $bookings variable there. But it is not showing even if I have data in my database.

Problems:

  1. The data is not showing in the calendar.
  2. How can I customize what data will be shown in the calendar.


from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ET2cmk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire