Laravel完整的日历错误

时间:2017-07-10 14:52:20

标签: php laravel fullcalendar

我知道这里有很多关于这个问题的问题,但不幸的是我无法解决我的错误。

我的代码:

  use  namespace App;

use Illuminate\Database\Eloquent\Model;

class EventModel extends Model implements \MaddHatter\LaravelFullcalendar\Event
{
    //
    protected $dates = ['start', 'end'];
    protected $table = 'event_model';

    public function getId() {
        return $this->id;
    }

    /**
     * Get the event's title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Is it an all day event?
     *
     * @return bool
     */
    public function isAllDay()
    {
        return (bool)$this->all_day;
    }

    /**
     * Get the start time
     *
     * @return DateTime
     */
    public function getStart()
    {
        return $this->start;
    }

    /**
     * Get the end time
     *
     * @return DateTime
     */
    public function getEnd()
    {
        return $this->end;
    }
    // Implement all Event methods ...

        /**
         * Get the event's ID
         *
         * @return int|string|null
         */
}

我的控制员:

      $events = [];
  $events[] = $events[] = \Calendar::event(
    'Teste',
     false,
     '2017-07-10',
     '2017-07-10'
   );
  $events[] = \Calendar::event(
    'Teste2', //event title
    true, //full day event?
    new DateTime('2017-07-14'), //start time (you can also use Carbon instead of DateTime)
    new DateTime('2015-07-14') //end time (you can also use Carbon instead of DateTime)
  );

  $eloquentEvent = EventModel::first();
  $calendar = \Calendar::addEvents($events)
    ->addEvent($eloquentEvent, ['color' => '#800',
    ])->setOptions([
      'firstDay' => 1
    ])->setCallbacks(['viewRender' => 'function() {alert("Callbacks");}'
  ]);
  return view('my view', compact('calendar'))

我的观点:

    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.css"/> 
//...//
{!! $calendar->calendar() !!}
{!! $calendar->script() !!}

我的错误:

> 3:259 Uncaught TypeError: $(...).fullCalendar is not a function
    at HTMLDocument.<anonymous> (3:259)
    at j (jquery.js:3094)
    at Object.fireWith [as resolveWith] (jquery.js:3206)
    at Function.ready (jquery.js:3412)
    at HTMLDocument.I (jquery.js:3428)

我认为我的错误发生在脚本中,但是我在其他控制器中使用相同的lib具有相同的日历,并且它工作正常,不同的是这个控制器和这个视图有更多的代码,但我认为这不是一个问题

我需要帮助

0 个答案:

没有答案