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:
1public function events(): Collection 2{ 3 return Model::query() 4 ->whereDate('scheduled_at', '>=', $this->gridStartsAt) 5 ->whereDate('scheduled_at', '<=', $this->gridEndsAt) 6 ->get() 7 ->map(function (Model $model) { 8 return [ 9 'id' => $model->id,10 'title' => $model->title,11 'description' => $model->notes,12 'date' => $model->scheduled_at,13 ];14 });15}
Next, you need to include your component in any view as you would any Livewire component:
1<livewire:appointments-calendar/>2 3{{-- Specify year and month --}}4<livewire:appointments-calendar5 year="2019"6 month="12"7/>
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.
0 comments:
Post a Comment
Thanks