Postingan lainnya
cara nampilin data dari database ke fullcalendar?
gan gimana ya caranya biar dia bisa tampil gimana bikin shownya ? ane coba kaya gitu dan dari yutub banyak yang ga sesuai
cal1.PNGcal2.PNG
1 Jawaban:
<div>bisa coba ini gan </div><div><br>blade.php</div><pre><em><!-- Kalender --></em> <div class="row"> <div class="col-lg-12 col-xl-12 mb-2"> <div class="card"> <div class="card-header"> Kalender </div> <div class="card-body"> <div id='calendar'></div> </div> </div> </div> </div> <em><!-- /Kalender --></em></pre><div><br></div><pre><script> document.addEventListener('DOMContentLoaded', function() { var calendarEl = document.getElementById('calendar'); var today = new Date();
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
header: {
left: 'prevYear,prev,next,nextYear today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
},
defaultDate: today,
navLinks: true, <em>// can click day/week names to navigate views</em>
editable: false,
eventLimit: true, <em>// allow "more" link when too many events</em>
events : [
//undangan parsing data dari controller
@foreach($undangan as $und)
{
title : '{{ $und-&gt;suratmasuk-&gt;asal_surat . '|' .$und-&gt;suratmasuk-&gt;no_surat_masuk}}',
start : '{{ $und-&gt;tgl_start }}',
end : '{{ $und-&gt;tgl_end }}',
url: '{{ url('/undangan/lihat', $und-&gt;id) }}'
},
@endforeach
],
});
calendar.render();
});
&lt;/script&gt;</pre><div><br><br>semoga membantu</div>