PHPackages                             vitoutry/laravel-fullcalendar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vitoutry/laravel-fullcalendar

ActiveLibrary

vitoutry/laravel-fullcalendar
=============================

Laravel helper for FullCalendar.io

v1.4.3(5y ago)039MITPHPPHP &gt;=7.3.0

Since Feb 11Pushed 5y agoCompare

[ Source](https://github.com/vitoutry/laravel-fullcalendar)[ Packagist](https://packagist.org/packages/vitoutry/laravel-fullcalendar)[ RSS](/packages/vitoutry-laravel-fullcalendar/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (1)Versions (19)Used By (0)

Laravel 5 Full Calendar Helper
==============================

[](#laravel-5-full-calendar-helper)

[![Latest Stable Version](https://camo.githubusercontent.com/1d13b4c8468102d3d26fa19b5246a9af10cec0f60ef07c60c04348ac3b3a381d/68747470733a2f2f706f7365722e707567782e6f72672f7669746f757472792f6c61726176656c2d66756c6c63616c656e6461722f762f737461626c65)](https://packagist.org/packages/vitoutry/laravel-fullcalendar) [![Total Downloads](https://camo.githubusercontent.com/d9583cffc23a82628c038a2a74abcf2fbb0ed36b5d4c5d53644d3ecb71e79aeb/68747470733a2f2f706f7365722e707567782e6f72672f7669746f757472792f6c61726176656c2d66756c6c63616c656e6461722f646f776e6c6f616473)](https://packagist.org/packages/vitoutry/laravel-fullcalendar) [![Latest Unstable Version](https://camo.githubusercontent.com/c2bb619009d2b42ac6458143422dd1acb2b1b3d0ee4b356c7c86dc6c8b273f25/68747470733a2f2f706f7365722e707567782e6f72672f7669746f757472792f6c61726176656c2d66756c6c63616c656e6461722f762f756e737461626c65)](https://packagist.org/packages/vitoutry/laravel-fullcalendar) [![License](https://camo.githubusercontent.com/eaf593bb781deaa25c457e1a154a9cfa5cea9f21e2e68ebe96cc40cc865a4b66/68747470733a2f2f706f7365722e707567782e6f72672f7669746f757472792f6c61726176656c2d66756c6c63616c656e6461722f6c6963656e7365)](https://packagist.org/packages/vitoutry/laravel-fullcalendar)

***For Laravel 4.2: use the [laravel-4 branch](https://github.com/vitoutry/laravel-fullcalendar/tree/laravel-4)***

This is a simple helper package to make generating  in Laravel apps easier.

Installing
----------

[](#installing)

Require the package with composer using the following command:

```
composer require vitoutry/laravel-fullcalendar

```

Or add the following to your composer.json's require section and `composer update`

```
"require": {
	"vitoutry/laravel-fullcalendar": "~1.1"
}
```

### Laravel 7.0+

[](#laravel-70)

The provider and `Calendar` alias will be registered automatically.

You will also need to include [fullcalendar.io](http://fullcalendar.io/)'s files in your HTML.

Usage
-----

[](#usage)

### Creating Events

[](#creating-events)

#### Using `event()`:

[](#using-event)

The simpliest way to create an event is to pass the event information to `Calendar::event()`:

```
$event = \Calendar::event(
    "Valentine's Day", //event title
    true, //full day event?
    '2015-02-14', //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
    '2015-02-14', //end time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg),
	1, //optional event ID
	[
		'url' => 'http://full-calendar.io'
	]
);
```

#### Implementing `Event` Interface

[](#implementing-event-interface)

Alternatively, you can use an existing class and have it implement `Vitoutry\LaravelFullcalendar\Event`. An example of an Eloquent model that implements the `Event` interface:

```
class EventModel extends Eloquent implements \Vitoutry\LaravelFullcalendar\Event
{

    protected $dates = ['start', 'end'];

    /**
     * Get the event's id number
     *
     * @return int
     */
    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;
    }
}
```

#### `IdentifiableEvent` Interface

[](#identifiableevent-interface)

If you wish for your existing class to have event IDs, implement `\Vitoutry\LaravelFullcalendar\IdentifiableEvent` instead. This interface extends `\Vitoutry\LaravelFullcalendar\Event` to add a `getId()` method:

```
class EventModel extends Eloquent implements \Vitoutry\LaravelFullcalendar\IdentifiableEvent
{

	// Implement all Event methods ...

    /**
     * Get the event's ID
     *
     * @return int|string|null
     */
    public function getId();

}
```

### Additional Event Parameters

[](#additional-event-parameters)

If you want to add [additional parameters](http://fullcalendar.io/docs/event_data/Event_Object) to your events, there are two options:

#### Using `Calendar::event()`

[](#using-calendarevent)

Pass an array of `'parameter' => 'value'` pairs as the 6th parameter to `Calendar::event()`:

```
$event = \Calendar::event(
    "Valentine's Day", //event title
    true, //full day event?
    '2015-02-14', //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
    '2015-02-14', //end time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg),
	1, //optional event ID
	[
		'url' => 'http://full-calendar.io',
		//any other full-calendar supported parameters
	]
);
```

#### Add an `getEventOptions` method to your event class

[](#add-an-geteventoptions-method-to-your-event-class)

```
