Laravel Livewire Calendar Component
Published on by Paul Redmond
Laravel Livewire Calendar is a component by Andrés Santibáñez to show events in a good looking monthly calendar.
To get started with this component, you'll create a component that extends the LivewireCalendar
class and override the events()
method:
public function events(): Collection{ return Model::query() ->whereDate('scheduled_at', '>=', $this->gridStartsAt) ->whereDate('scheduled_at', '<=', $this->gridEndsAt) ->get() ->map(function (Model $model) { return [ 'id' => $model->id, 'title' => $model->title, 'description' => $model->notes, 'date' => $model->scheduled_at, ]; });}
Next, you need to include your component in any view as you would any Livewire component:
<livewire:appointments-calendar/> {{-- Specify year and month --}}<livewire:appointments-calendar year="2019" month="12"/>
This component also provides more advanced UI customization. Check out the readme for advanced customization. You can learn more about this package, get full installation instructions, and view the source code on GitHub.