PHPackages                             naowas/laravel-full-calendar - 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. naowas/laravel-full-calendar

ActiveLibrary

naowas/laravel-full-calendar
============================

Laravel helper for FullCalendar.io. Fork of https://github.com/maddhatter/laravel-fullcalendar

v2.0.0(2y ago)1942↓100%2[1 PRs](https://github.com/naowas/laravel-full-calendar/pulls)MITPHPPHP ^8.0|^8.2

Since Sep 14Pushed 1y agoCompare

[ Source](https://github.com/naowas/laravel-full-calendar)[ Packagist](https://packagist.org/packages/naowas/laravel-full-calendar)[ Docs](https://github.com/nelkasovic/laravel-full-calendar)[ RSS](/packages/naowas-laravel-full-calendar/feed)WikiDiscussions master Synced 1mo ago

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

Laravel 6 Full Calendar Helper
==============================

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

This is a fork of . A simple helper package to make generating  in Laravel apps easier. Because the package is abandoned I decided to fork and publish a version which should work with Laravel 6.

Installing
----------

[](#installing)

Require the package with composer using the following command:

```
composer require naowas/laravel-full-calendar

```

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

### Laravel 5.4 (and earlier)

[](#laravel-54-and-earlier)

Register the service provider in your `app.php` config file:

```
LaravelFullCalendar\FullCalendarServiceProvider::class,
```

And optionally create an alias:

```
'Calendar' => LaravelFullCalendar\Facades\Calendar::class,
```

### Laravel 5.5+

[](#laravel-55)

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?
    '2020-02-14', //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
    '2020-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 `LaravelFullCalendar\Event`. An example of an Eloquent model that implements the `Event` interface:

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

```
class EventModel extends Eloquent implements \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?
    '2020-02-14', //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
    '2020-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)

```
