diff --git a/composer.json b/composer.json index ac6cc19..54cd5f2 100644 --- a/composer.json +++ b/composer.json @@ -17,5 +17,15 @@ "MaddHatter\\LaravelFullcalendar": "src/" } }, + "extra": { + "laravel": { + "providers": [ + "MaddHatter\\LaravelFullcalendar\\ServiceProvider" + ], + "aliases": { + "Calendar": "MaddHatter\\LaravelFullcalendar\\Facades\\Calendar" + } + } + }, "minimum-stability": "stable" } diff --git a/readme.md b/readme.md index c294405..21186b6 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,9 @@ Or add the following to your composer.json's require section and `composer updat } ``` -Then register the service provider in your `app.php` config file: +### Laravel 5.4 (and earlier) + +Register the service provider in your `app.php` config file: ```php MaddHatter\LaravelFullcalendar\ServiceProvider::class, @@ -32,6 +34,9 @@ And optionally create an alias: ``` +### Laravel 5.5+ +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 @@ -57,7 +62,7 @@ $event = \Calendar::event( #### Implementing `Event` Interface Alternatively, you can use an existing class and have it implement `MaddHatter\LaravelFullcalendar\Event`. An example of an Eloquent model that implements the `Event` interface: - + ```php class EventModel extends Eloquent implements \MaddHatter\LaravelFullcalendar\Event { @@ -178,7 +183,7 @@ class CalendarEvent extends \Illuminate\Database\Eloquent\Model implements \Madd 'color' => $this->background_color, //etc ]; - } + } //... } @@ -218,7 +223,7 @@ $calendar = \Calendar::addEvents($events) //add an array with addEvents 'firstDay' => 1 ])->setCallbacks([ //set fullcalendar callback options (will not be JSON encoded) 'viewRender' => 'function() {alert("Callbacks!");}' - ]); + ]); return view('hello', compact('calendar')); ``` @@ -236,7 +241,7 @@ Then to display, add the following code to your View: - +