fullcalendar js installation laravel code example

Example 1: how i can send by database table in laravel full calendar

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Calendar;
use App\Event;

class EventController extends Controller
{
    public function index()
    {
        $events = [];
        $data = Event::all();
        if($data->count()) {
            foreach ($data as $key => $value) {
                $events[] = Calendar::event(
                    $value->title,
                    true,
                    new \DateTime($value->start_date),
                    new \DateTime($value->end_date.' +1 day'),
                    null,
                    // Add color and link on event
                    [
                        'color' => '#f05050',
                        'url' => 'pass here url and any route',
                    ]
                );
            }
        }
        $calendar = Calendar::addEvents($events);
        return view('fullcalendar', compact('calendar'));
    }
}

Example 2: how i can send by database table in laravel full calendar

'providers' => [
    .....
    .....
    MaddHatter\LaravelFullcalendar\ServiceProvider::class,
],
'aliases' => [
    .....
    .....
    'Calendar' => MaddHatter\LaravelFullcalendar\Facades\Calendar::class,
]

Tags:

Php Example