From 9a709e964d4d1d6fd8e76eac0cdcf86b2b6c7eae Mon Sep 17 00:00:00 2001 From: Josh Torres Date: Wed, 7 Feb 2024 09:10:33 -0800 Subject: [PATCH] - fix id and getId() errors depending on which version of livewire you are on --- src/LivewireCalendar.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/LivewireCalendar.php b/src/LivewireCalendar.php index 274acd9..672af25 100755 --- a/src/LivewireCalendar.php +++ b/src/LivewireCalendar.php @@ -226,6 +226,18 @@ public function onEventDropped($eventId, $year, $month, $day) // } + public function getId() + { + if (!empty($this->__id)) { + $id = $this->__id; + } else if (!empty($this->id)) { + $id = $this->id; + } else { + $id = 'livewire-calendar-' . uniqid(); + } + return $id; + } + /** * @return Factory|View * @throws Exception @@ -236,7 +248,7 @@ public function render() return view($this->calendarView) ->with([ - 'componentId' => $this->id, + 'componentId' => $this->getId(), 'monthGrid' => $this->monthGrid(), 'events' => $events, 'getEventsForDay' => function ($day) use ($events) {