The parameters directly from $request->input('start') and $request->input('end')are null. From Carbon both start and end are 2019-12-31T23:00:00.000000Z. So obviously, there's an issue with the request. I converted the $requestto JSON and there's nothing in:
{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}
The slash you mention is also in my URL. If using var FEED_URL = "/event-feed"; or var FEED_URL = "{{url('/')}}" + "/event-feed"; makes no difference, it results in the URL http://localhost/matpro/public/event-feed, which is how it should be, right?
Your approach adding another level throws a failure from the calendar but I added it by
$eventOutput = [
'events' => $events
];
return json_encode($eventOutput);
and now the JSON is:
{"events":{"id":1,"title":"Test","start":"2020-06-12T23:00:00.000000Z","end":"2020-06-13T23:00:00.000000Z","left":null,"right":null}}
Here is my full calendar. I don't set initial date, because the manual says "defaultDate: When not specified, this value defaults to the current date."
var FEED_URL = "{{url('/')}}" + "/event-feed";
alert (FEED_URL);
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
locale: 'de',
plugins: [ 'interaction', 'resourceTimeline' ],
timeZone: 'UTC',
defaultView: 'resourceTimelineWeek',
editable: true,
titleFormat: { year: 'numeric', month: '2-digit', day: '2-digit' },
views: {
week: {
type: 'resourceTimelineWeek',
duration: { weeks: 1 },
slotDuration: {days: 1},
buttonText: 'Woche'
},
d14: {
type: 'resourceTimelineWeek',
duration: { weeks: 2 },
slotDuration: {days: 1},
buttonText: '14 Tage'
},
month: {
type: 'resourceTimelineWeek',
duration: { days: 31 },
slotDuration: {days: 1},
buttonText: 'Monat'
}
},
header: {
center: 'week,d14,month',
right: 'today prev,next'
},
slotLabelFormat: [
{ month: 'long', year: 'numeric' }, // top level of text
{ weekday: 'short', day: '2-digit' } // lower level of text
],
resourceLabelText: 'Ressource',
resources: [
{
id: 'a',
title: 'Room A'
}
],
events: {
url: FEED_URL,
method: 'GET',
dateType:'json',
failure: function() {
alert('there was an error while fetching events!');
},
success: function() {
alert('we have the data');
},
}
});
calendar.render();
});