完整的Callendar脚本未出现在Laravel Project中

时间:2019-04-18 14:16:48

标签: laravel-5.8

我正在为事件使用Calendar类,并且它没有出现在视图中

enter image description here 1)我的控制器

public function index(){
    $events = Event::get();
    $event_list = [];
    foreach ($events as $key => $event) {
        $event_list[] = Calendar::event(
            $event->event_name,
            true,
            new \DateTime($event->start_date),
            new \DateTime($event->end_date.' +1 day')
        );
    }
    $calendar_details = Calendar::addEvents($event_list); 

    return view('pages.events.event', compact('calendar_details') );
}

2)我的视图

<div class="card">
    <div class="card-header bg-primary text-white text-center h3">MY Event Details</div>
    <div class="card-body">
        {!! $calendar_details->calendar() !!}
    </div>
</div>

3)我在主体关闭标记上方的头部和脚本中添加了css文件。

    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.js"></script>
    <script>
            @yield('pageScript')

    </script>

    {!! $calendar_details->script() !!}

0 个答案:

没有答案