“Bagaimana Saya Dapat Mengirimkan Tabel Database di Laravel Kalender Penuh” Kode Jawaban

Bagaimana Saya Dapat Mengirimkan Tabel Database di Laravel Kalender Penuh

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'));
    }
}
Dev

Bagaimana Saya Dapat Mengirimkan Tabel Database di Laravel Kalender Penuh

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

Bagaimana Saya Dapat Mengirimkan Tabel Database di Laravel Kalender Penuh

@extends('layouts.app')

@section('style')
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.css"/>
@endsection

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Full Calendar Example</div>

                <div class="panel-body">
                    {!! $calendar->calendar() !!}
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('script')
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.js"></script>
{!! $calendar->script() !!}
@endsection
Dev

Jawaban yang mirip dengan “Bagaimana Saya Dapat Mengirimkan Tabel Database di Laravel Kalender Penuh”

Pertanyaan yang mirip dengan “Bagaimana Saya Dapat Mengirimkan Tabel Database di Laravel Kalender Penuh”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya