public function calendar($date)
    {
        $events = $this->eventRepository->all();
        $dateArray = explode('-', $date);
        $daysInMonth = Carbon::create($dateArray[0], $dateArray[1], $dateArray[2])->daysInMonth;

        $eventsByDate = [];

        foreach (range(1, $daysInMonth) as $day) {
            $date = $dateArray[0].'-'.$dateArray[1].'-'.sprintf('%02d', $day);
            foreach ($events as $event) {
                $startDate = explode('-', $event->start_date);
                $endDate = explode('-', $event->end_date);
                $first = Carbon::create($startDate[0], $startDate[1], $startDate[2]);
                $second = Carbon::create($endDate[0], $endDate[1], $endDate[2]);
                if (Carbon::create($dateArray[0], $dateArray[1], sprintf('%02d', $day))->between($first, $second)) {
                    $eventsByDate[$date][] = $event;
                }
            }
        }

        return $eventsByDate;
    }