Skip to content

Ordering events based on column #76

Closed Answered by wdelfuego
Eli-Pez asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there, sorry for the late reply.

The events are ordered by start time on the calendar, but you're not forced to show the start time.
So if only the day is relevant, you could abuse the time field to force an ordering of your choice.

I think this should work; implement the customizeEvent method in your CalendarController as follows:

protected function customizeEvent(Event $event) : Event
{
    if($event->model()) {
        $event->hideTime()
              ->withStart($event->start()->setTime(12, $event->model()->livello));
    }

    return $event;
}

This might be overly safe; you could skip the if($event->model()) check if your event generator already guarantees that each calendar eve…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Eli-Pez
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants