All Projects → Edofre → laravel-fullcalendar

Edofre / laravel-fullcalendar

Licence: MIT license
Laravel Fullcalendar component

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to laravel-fullcalendar

yii2-fullcalendar
Yii 2 component for easy fullcalendar integration
Stars: ✭ 21 (-63.16%)
Mutual labels:  calendar, fullcalendar
svelte-fullcalendar
A Svelte component wrapper around FullCalendar
Stars: ✭ 123 (+115.79%)
Mutual labels:  calendar, fullcalendar
Tui.calendar
🍞📅A JavaScript calendar that has everything you need.
Stars: ✭ 9,537 (+16631.58%)
Mutual labels:  calendar, fullcalendar
calendar-view-plugin
Jenkins Calendar View Plugin: Shows past and future builds in a calendar view
Stars: ✭ 17 (-70.18%)
Mutual labels:  calendar, fullcalendar
yii2-fullcalendar-scheduler
Yii 2 component for easy fullcalendar scheduler integration
Stars: ✭ 24 (-57.89%)
Mutual labels:  calendar, fullcalendar
LunarCalendar
A lightweight macOS App for displaying calendar and time
Stars: ✭ 82 (+43.86%)
Mutual labels:  calendar
BlazorFullCalendar
A Server-Side-Blazor wrapper for FullCalender.io
Stars: ✭ 24 (-57.89%)
Mutual labels:  fullcalendar
mhc
MHC -- Message Harmonized Calendaring system
Stars: ✭ 20 (-64.91%)
Mutual labels:  calendar
datebook
📅 Generates URLs and downloadable ICS files for adding events to popular calendar apps.
Stars: ✭ 273 (+378.95%)
Mutual labels:  calendar
ionic4-date-picker
Calendar date picker for Ionic4 apps
Stars: ✭ 24 (-57.89%)
Mutual labels:  calendar
GDCalendar
Calendar component with RTL languages written in swift
Stars: ✭ 27 (-52.63%)
Mutual labels:  calendar
croncal
Utility to convert a crontab file to a list of actual events within a date range.
Stars: ✭ 37 (-35.09%)
Mutual labels:  calendar
react-native-daterange-picker
A React Native component for picking date ranges or single dates.
Stars: ✭ 86 (+50.88%)
Mutual labels:  calendar
webmail-pro-8
Webmail front-end for existing mail server, with personal calendar, contacts, and mobile sync.
Stars: ✭ 23 (-59.65%)
Mutual labels:  calendar
js-calendar
The lightest Javascript calendar out there, without any dependency.
Stars: ✭ 37 (-35.09%)
Mutual labels:  calendar
gahshomar
A Persian (Jalali/Farsi) calendar for Linux
Stars: ✭ 69 (+21.05%)
Mutual labels:  calendar
regional-rb-calendar
地域.rbの開催情報を集めたカレンダーです
Stars: ✭ 12 (-78.95%)
Mutual labels:  calendar
BusinessDays.jl
📆 A highly optimized Business Days calculator written in Julia language. Also known as Working Days calculator.
Stars: ✭ 53 (-7.02%)
Mutual labels:  calendar
Daylight-Calendar-ICS
Daylight Calendar is a dynamically generated .ics calendar that you can host and subscribe to in Google Calendar, iCal, or other calendar software.
Stars: ✭ 22 (-61.4%)
Mutual labels:  calendar
DailyImageWidget
Android 桌面小部件(widget)日签 Or 日历,可作为桌面日历。Just For Fun! 🎮
Stars: ✭ 30 (-47.37%)
Mutual labels:  calendar

Laravel fullcalendar component

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock Build Status Scrutinizer Code Quality

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require edofre/laravel-fullcalendar

or add

"edofre/laravel-fullcalendar": "V1.2.4"

to the require section of your composer.json file.

Note

The fxp/composer-asset plugin is required for this package to install properly. This plugin enables you to download bower packages through composer.

You can install it using this command:

composer global require "fxp/composer-asset-plugin:^1.4.0”

This will add the fxp composer-asset-plugin and your composer will be able to find and download the required bower-asset/fullcalendar package. You can find more info on this page: https://packagist.org/packages/fxp/composer-asset-plugin.

Configuration

Add the ServiceProvider to your config/app.php

'providers' => [
        ...
        Edofre\Fullcalendar\FullcalendarServiceProvider::class,
    ],

And add the facade

'aliases' => [
        ...
        'Fullcalendar' => Edofre\Fullcalendar\Facades\Fullcalendar::class,
    ],

Publish assets and configuration files

php artisan vendor:publish --tag=config
php artisan vendor:publish --tag=fullcalendar

Manually loading script files

By setting the include_scripts option in the config/.env file to false the scripts will not be included when generating the calendar. If you want to manually include the scripts you can call the following static function in your header/footer/etc.

    \Edofre\Fullcalendar\Fullcalendar::renderScriptFiles();

Example

Below is an example of a controller action configuring the calendar

    public function index()
    {
        // Generate a new fullcalendar instance
        $calendar = new \Edofre\Fullcalendar\Fullcalendar();

        // You can manually add the objects as an array
        $events = $this->getEvents();
        $calendar->setEvents($events);
        // Or you can add a route and return the events using an ajax requests that returns the events as json
        $calendar->setEvents(route('fullcalendar-ajax-events'));

        // Set options
        $calendar->setOptions([
            'locale'      => 'nl',
            'weekNumbers' => true,
            'selectable'  => true,
            'defaultView' => 'agendaWeek',
            // Add the callbacks
            'eventClick' => new \Edofre\Fullcalendar\JsExpression("
                function(event, jsEvent, view) {
                    console.log(event);
                }
            "),
            'viewRender' => new \Edofre\Fullcalendar\JsExpression("
                function( view, element ) {
                    console.log(\"View \"+view.name+\" rendered\");
                }
            "),
        ]);

        // Check out the documentation for all the options and callbacks.
        // https://fullcalendar.io/docs/

        return view('fullcalendar.index', [
            'calendar' => $calendar,
        ]);
    }

    /**
     * @param Request $request
     * @return string
     */
    public function ajaxEvents(Request $request)
    {
        // start and end dates will be sent automatically by fullcalendar, they can be obtained using:
        // $request->get('start') & $request->get('end')
        $events = $this->getEvents();
        return json_encode($events);
    }

    /**
     * @return array
     */
    private function getEvents()
    {
        $events = [];
        $events[] = new \Edofre\Fullcalendar\Event([
            'id'     => 0,
            'title'  => 'Rest',
            'allDay' => true,
            'start'  => Carbon::create(2016, 11, 20),
            'end'    => Carbon::create(2016, 11, 20),
        ]);

        $events[] = new \Edofre\Fullcalendar\Event([
            'id'    => 1,
            'title' => 'Appointment #' . rand(1, 999),
            'start' => Carbon::create(2016, 11, 15, 13),
            'end'   => Carbon::create(2016, 11, 15, 13)->addHour(2),
        ]);

        $events[] = new \Edofre\Fullcalendar\Event([
            'id'               => 2,
            'title'            => 'Appointment #' . rand(1, 999),
            'editable'         => true,
            'startEditable'    => true,
            'durationEditable' => true,
            'start'            => Carbon::create(2016, 11, 16, 10),
            'end'              => Carbon::create(2016, 11, 16, 13),
        ]);

        $events[] = new \Edofre\Fullcalendar\Event([
            'id'               => 3,
            'title'            => 'Appointment #' . rand(1, 999),
            'editable'         => true,
            'startEditable'    => true,
            'durationEditable' => true,
            'start'            => Carbon::create(2016, 11, 14, 9),
            'end'              => Carbon::create(2016, 11, 14, 10),
            'backgroundColor'  => 'black',
            'borderColor'      => 'red',
            'textColor'        => 'green',
        ]);
        return $events;
    }

You can then render the calendar by generating the HMTL and scripts

    {!! $calendar->generate() !!}

Tests

Run the tests by executing the following command:

composer test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].