I've tried this link https://github.com/maddhatter/laravel-fullcalendar.
Below codes are taken from the above link:
1) In composer.json
"require": {"maddhatter/laravel-fullcalendar": "~1.0" }
2) In app.php
'providers' => [MaddHatter\LaravelFullcalendar\ServiceProvider::class,]
'aliases' => ['Calendar' => MaddHatter\LaravelFullcalendar\Facades\Calendar::class,]
3) In controller
use MaddHatter\LaravelFullcalendar\Facades\Calendar;
class CalendarEvent extends \Illuminate\Database\Eloquent\Model implements \MaddHatter\LaravelFullcalendar\Event
{
public function ViewSchdule($id,$program)
{
$events = [];
$events[] = \Calendar::event(
'Event One', //event title
false, //full day event?
'2015-02-11T0800', //start time (you can also use Carbon instead of DateTime)
'2015-02-12T0800', //end time (you can also use Carbon instead of DateTime)
0, //optionally, you can specify an event ID
[
'url' => 'http://full-calendar.io'
]
);
$events[] = \Calendar::event(
"Valentine's Day", //event title
true, //full day event?
new \DateTime('2015-02-14'), //start time (you can also use Carbon instead of DateTime)
new \DateTime('2015-02-14'), //end time (you can also use Carbon instead of DateTime)
'stringEventId', //optionally, you can specify an event ID
[
'url' => 'http://full-calendar.io'
]
);
$eloquentEvent = EventModel::first(); //EventModel implements MaddHatter\LaravelFullcalendar\Event
$calendar = \Calendar::addEvents($events) //add an array with addEvents
->addEvent($eloquentEvent, [ //set custom color fo this event
'color' => '#800',
])->setOptions([ //set fullcalendar options
'firstDay' => 1
])->setCallbacks([ //set fullcalendar callback options (will not be JSON encoded)
'viewRender' => 'function() {alert("Callbacks!");}'
]);
return view('view-schedule', compact('calendar'));
}
}
4) In view
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<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"/>
{!! $calendar->calendar() !!}
{!! $calendar->script() !!}
I've added the above codes, but i got the error below
FatalErrorException in ProviderRepository.php line 146: Class 'MaddHatter\LaravelFullcalendar\ServiceProvider' not found
Please give your idea for this laravel beginner.
via Geetha Lakshmi