PHPackages                             malikadel/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. malikadel/laravel-fullcalendar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

malikadel/laravel-fullcalendar
==============================

Laravel 7/8 helper for FullCalendar.io

v1.2(5y ago)110MITPHPPHP &gt;=5.4.0

Since Nov 1Pushed 5y agoCompare

[ Source](https://github.com/malikadel/laravel-fullcalendar)[ Packagist](https://packagist.org/packages/malikadel/laravel-fullcalendar)[ RSS](/packages/malikadel-laravel-fullcalendar/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (7)Used By (0)

Laravel 8 Helper for fullcalendar.io
====================================

[](#laravel-8-helper-for-fullcalendario)

[![Latest Stable Version](https://camo.githubusercontent.com/ba95e850eca3fc8f0cb0f4c64095b8ec9b12fdaa3ae0a74b94533cedaf59b69e/68747470733a2f2f706f7365722e707567782e6f72672f61736466782f6c61726176656c2d66756c6c63616c656e6461722f76)](//packagist.org/packages/asdfx/laravel-fullcalendar)[![Total Downloads](https://camo.githubusercontent.com/41d2bb1fcc7fd46a15f9d3ef4bc068e4608df7618552ccbf2d3ec39407924deb/68747470733a2f2f706f7365722e707567782e6f72672f61736466782f6c61726176656c2d66756c6c63616c656e6461722f646f776e6c6f616473)](//packagist.org/packages/asdfx/laravel-fullcalendar)[![License](https://camo.githubusercontent.com/f90cc3d9a6054b2d31a38daef351e4894ec34660f0df5ceda213183fd271202b/68747470733a2f2f706f7365722e707567782e6f72672f61736466782f6c61726176656c2d66756c6c63616c656e6461722f6c6963656e7365)](//packagist.org/packages/asdfx/laravel-fullcalendar)[![CircleCI](https://camo.githubusercontent.com/2bf63f480b8b27e9fdeb39c05c1fb2821fd51d821697f307f27d7aa592eb6fad/68747470733a2f2f636972636c6563692e636f6d2f67682f61676a6d696c6c732f6c61726176656c2d66756c6c63616c656e6461722e7376673f7374796c653d736869656c64)](https://circleci.com/gh/agjmills/laravel-fullcalendar)

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

For fullcalendar &lt;=2.0, please use the v1 version. For v4 onwards, please use the v2 version.

Installing
----------

[](#installing)

Require the package with composer using the following command:

```
composer require malikadel/laravel-fullcalendar

```

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

```
"require": {
	"malikadel/laravel-fullcalendar": "^1.0"
}
```

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 `Asdfx\LaravelFullcalendar\Event`. An example of an Eloquent model that implements the `Event` interface:

```
class EventModel extends Eloquent implements \Asdfx\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 `\Asdfx\LaravelFullcalendar\IdentifiableEvent` instead. This interface extends `\Asdfx\LaravelFullcalendar\Event` to add a `getId()` method:

```
class EventModel extends Eloquent implements \Asdfx\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)

```
