Laravel Packages

Laravel Livewire Calendar Component

Published
Laravel Livewire Calendar Component image

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.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Laravel Rulebook: Business Rules That Change by Date image

Laravel Rulebook: Business Rules That Change by Date

Read article
Taylor disabled GitHub Issues on most Laravel open-source packages. image

Taylor disabled GitHub Issues on most Laravel open-source packages.

Read article
Exclude Vendor and Default Commands in `php artisan dev` image

Exclude Vendor and Default Commands in `php artisan dev`

Read article
The Laracon Archive image

The Laracon Archive

Read article
Group Adjacent Collection Items in Laravel with chunkBy() image

Group Adjacent Collection Items in Laravel with chunkBy()

Read article
Laravel queue:work Now Prints Why the Worker Stopped image

Laravel queue:work Now Prints Why the Worker Stopped

Read article