2017 © Pedro Peláez
 

library calendar-events

Full calendar events module for Laravel

image

todstoychev/calendar-events

Full calendar events module for Laravel

  • Friday, November 3, 2017
  • by todstoychev
  • Repository
  • 6 Watchers
  • 15 Stars
  • 237 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 11 Versions
  • 2 % Grown

The README.md

Build Status, (*1)

Laravel 5 module to integrate a fullcalendar javascript plugin. It provides simple way to store events in the database and supports event repeat., (*2)

Installation

Use the standard way composer require todstoychev/calendar-events., (*3)

Register the service provider at your Laravel config/app.php. You should add Todstoychev\CalendarEvents\CalendarEventsServiceProvider::class., (*4)

Run php artisan vendor:publish to publish config and other assets., (*5)

This module provides also 3 migration files. It will be necessary to run them php artisan migrate., (*6)

Usage

Forms

This module comes with a ready to use form template. The form can be used as edit and add form. In your blade use @include('calendar-events::form') to include it in your page. Also feel free to override and extend this template., (*7)

To use this form add to your page you will need a javascript file provided from the module. After running vendor publish command you should be able to find public/js/calendar-events.js. This script is necessary to control provided form. It contains simple JS object with few methods inside., (*8)

Controller

Since this module has service provider at the container, you can access CalendarEventsService::class in your controller like this:, (*9)

protected $calendarEventsService;

    public function __construct(CalendarEventsService $calendarEventsService)
    {
        $this->calendarEventsService = $calendarEventsService;
    }

This the main module class that contains all the necessary methods to interact with., (*10)

Module provides a request class which can be used to validate your input data. Here an example usage of how to create new event., (*11)

<?php

namespace App\Http\Controllers;

use Todstoychev\CalendarEvents\Http\Requests\CalendarEventRequest;
use Todstoychev\CalendarEvents\Services\CalendarEventsService;

class IndexController extends Controller
{
    protected $calendarEventsService;

    public function __construct(CalendarEventsService $calendarEventsService)
    {
        $this->calendarEventsService = $calendarEventsService;
    }

    public function postAdd(CalendarEventRequest $request)
    {
        $this->calendarEventsService->createCalendarEvent($request->input());
    }
}

The service class has methods to provide fully functional crud. To update event you can use CalendarEventsService::updateCalendarEvent(). To get a single event use CalendarEventsService::getCalendarEvent(). CalendarEventsService::getAllEvents() will fetch all calendar events. The most important method is probably CalendarEventsService::getAllEventsToJson(). This one should be used with the javascript plugin. The method provides the necessary json string. Here example of usage. In your controller create a method like this one:, (*12)

     public function getJson()
     {
         echo $this->calendarEventsService->getAllEventsAsJson();
     }

This one should be used with fullcalendar like this:, (*13)

<div id="calendar"></div>
<script src="{{ asset('jquery.js') }}"></script>
<script src="{{ asset('js/calendar-events.js') }}"></script> <!-- This is where the CalendarEvents object comes from. -->
<script src="{{ asset('fullcalendar/lib/moment.min.js') }}"></script>
<script src="{{ asset('fullcalendar/fullcalendar.min.js') }}"></script>
<script>
    $(document).ready(function () {
        CalendarEvents.init();
        $('#calendar').fullCalendar({
            eventSources: [
                {
                    url: 'http://example.com/json'
                }
            ]
        });
    });
</script>

Do not forget that you will need to include fullcalendar plugin in your project., (*14)

TODO

  • Add more PHPUnit test to achieve maximum coverage.
  • Create Bootstrap 3 compatible templates for the form.
  • Add functionality to repeat event each week, month and year.
  • Add functionality to select weekdays on which event will be repeated.
  • Add functionality to repeat event after number of days.
  • Add functionality to repeat event certain times.

The Versions

03/11 2017

dev-develop

dev-develop

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

03/11 2017

dev-master

9999999-dev

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

03/11 2017

1.0.0

1.0.0.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

27/10 2017

dev-release/1.0.0

dev-release/1.0.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

11/02 2017

0.2.0

0.2.0.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

30/01 2017

0.1.5

0.1.5.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

28/01 2017

0.1.4

0.1.4.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

28/01 2017

0.1.3

0.1.3.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

28/01 2017

0.1.2

0.1.2.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

28/01 2017

0.1.1

0.1.1.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar

28/01 2017

0.1.0

0.1.0.0

Full calendar events module for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todor Todorov

laravel calendar events fullcalendar