2017-09-12 12:43:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Jobs\GenerateCalendarEvents;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ReportController.
|
|
|
|
*/
|
|
|
|
class CalendarController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
*/
|
|
|
|
public function showCalendar()
|
|
|
|
{
|
|
|
|
$data = [
|
2017-09-13 10:56:26 +02:00
|
|
|
'account' => auth()->user()->account,
|
2017-09-12 12:43:59 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
return view('calendar', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loadEvents()
|
|
|
|
{
|
2017-09-13 10:56:26 +02:00
|
|
|
if (auth()->user()->account->hasFeature(FEATURE_REPORTS)) {
|
|
|
|
$events = dispatch(new GenerateCalendarEvents());
|
|
|
|
} else {
|
|
|
|
$events = [];
|
|
|
|
}
|
2017-09-12 12:43:59 +02:00
|
|
|
|
|
|
|
return response()->json($events);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|