2017 © Pedro Peláez
 

library laravel-gantt

Laravel package to display items within a Gantt Chart.

image

adzon/laravel-gantt

Laravel package to display items within a Gantt Chart.

  • Saturday, May 6, 2017
  • by adzon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel Gantt Chart

License, (*1)

A Laravel 5.x package to display items within a Gantt chart (adapted from bastianallgeier/gantti)., (*2)

Screenshot, (*3)

Installation

Require this package with composer:, (*4)

composer require swatkins/laravel-gantt

After updating composer, add the ServiceProvider to the providers array in config/app.php, (*5)

Swatkins\LaravelGantt\GanttServiceProvider::class,

Copy the package css file to your local css with the publish command:, (*6)

php artisan vendor:publish --tag="gantt"

Usage

The model to display in the Gantt Chart will need to have properties of label, start and end at minimum., (*7)

  • label is the string to display for the item
  • start is a date or datetime (will need to pass this as a YYYY-MM-DD format)
  • end is a date or datetime (will need to pass this as a YYYY-MM-DD format)

/** * You'll pass data as an array in this format: $test_array = [ [ 'label' => 'The item title', 'date' => [ [ 'start' => '2016-10-08', 'end' => '2016-10-14', 'class' => '', ], [ 'start' => '2016-10-16', 'end' => '2016-10-19', 'class' => '', ] ] ] ]; */ $gantt = new Swatkins\LaravelGantt\Gantt($test_array, array( 'title' => 'Demo', 'cellwidth' => 25, 'cellheight' => 35 )); return view('gantt')->with([ 'gantt' => $gantt ]);

Display in your view

In your view, add the gantt.css file:, (*8)

<link href="/vendor/swatkins/gantt/css/gantt.css" rel="stylesheet" type="text/css">

And then output the gantt HTML:, (*9)

{!! $gantt !!}

Model Factory

Here is a factory for creating test data for your projects. You can paste this into your database/factories/ModelFactory.php file and then run this via tinker. See https://laravel.com/docs/5.2/seeding#using-model-factories., (*10)

$factory->define(App\Project::class, function (Faker\Generator $faker) {
    return [
        'title' => $faker->sentence(),
        'start' => $faker->dateTimeBetween('-30 days'),
        'end' => $faker->dateTimeBetween('now', '+30 days')
    ];
});

Attribution

This code is adapted from https://github.com/bastianallgeier/gantti, (*11)

License:

MIT License - http://www.opensource.org/licenses/mit-license.php, (*12)

The Versions

06/05 2017

dev-master

9999999-dev

Laravel package to display items within a Gantt Chart.

  Sources   Download

MIT

06/05 2017

1.1

1.1.0.0

Laravel package to display items within a Gantt Chart.

  Sources   Download

MIT

06/05 2017

dev-dev-zhc

dev-dev-zhc

Laravel package to display items within a Gantt Chart.

  Sources   Download

MIT

06/05 2017

dev-zhc

dev-zhc

Laravel package to display items within a Gantt Chart.

  Sources   Download

MIT

09/10 2016

v1.0.0

1.0.0.0

Laravel package to display items within a Gantt Chart.

  Sources   Download

MIT

by Scott Watkins