1

I want to display more calendars on laravel-admin grid, but fullcalendar events were accumulated, so what can I do? I think maybe can clear events before? thanks. my code like this:

$grid->column('name', __('name'))->modal('calendar', function ($model) {
    $id = $model->id;
    $punches = DB::table('punches')->where('userid', $id)->get();
    $punches = $punches->map(function ($punch) use ($id) {
        return Calendar::event($punch->id, true, $punch->start_date, $punch->end_date, "stringEventId");
    });
    $calendar = Calendar::addEvents($punches)->setId('calendar-' . $id);
    return $calendar->calendar().$calendar->script();
});

0 Answers0