Skip to content

Commit

Permalink
Merge pull request #86 from davidcb/master
Browse files Browse the repository at this point in the history
Added support for Auto Package Discovery
  • Loading branch information
maddhatter authored Sep 18, 2017
2 parents 9d9e937 + 012ec4b commit 6502ee3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,15 @@
"MaddHatter\\LaravelFullcalendar": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"MaddHatter\\LaravelFullcalendar\\ServiceProvider"
],
"aliases": {
"Calendar": "MaddHatter\\LaravelFullcalendar\\Facades\\Calendar"
}
}
},
"minimum-stability": "stable"
}
15 changes: 10 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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
{
Expand Down Expand Up @@ -178,7 +183,7 @@ class CalendarEvent extends \Illuminate\Database\Eloquent\Model implements \Madd
'color' => $this->background_color,
//etc
];
}
}

//...
}
Expand Down Expand Up @@ -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'));
```
Expand All @@ -236,7 +241,7 @@ Then to display, add the following code to your View:
<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"/>


<style>
/* ... */
Expand Down

0 comments on commit 6502ee3

Please sign in to comment.