I am working with fullcalendar and laravel, I bring the data from the contractor, since they are shown in the console, but I can not make them appear in the calendar. This is my code:
routes.php
Route::get('events','EventsController@showEvents');
EventsController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\model\eventsModel;
class EventsController extends Controller
{
public function showEvents(){
$events = eventsModel::all();
return response()->json($events);
}
}
index.blade.html
$('#calendar').fullCalendar({
businessHours: {
// days of week. an array of zero-based day of week integers (0=Sunday)
dow: [ 1, 2, 3, 4 ], // Monday - Thursday
start: '10:00', // a start time (10am in this example)
end: '19:00', // an end time (6pm in this example)
},
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
height: 500,
slotMinutes: 15,
loading: function(bool){
if (bool)
$('#loading').show();
else
$('#loading').hide();
},
minTime: '10:00',
maxTime: '19:00',
selectable: true,
events:
$.ajax({
type:'get',
url:'events',
success: function (data)
{
console.log(data);
$('#calendar').fullCalendar({
events: data
});
}
}),
I do not generate any errors, just do not show the events.
please suggestions thanks