Skip to content

Commit

Permalink
- fix id and getId() errors depending on which version of livewire yo…
Browse files Browse the repository at this point in the history
…u are on
  • Loading branch information
joshtorres committed Feb 7, 2024
1 parent 19234a2 commit 9a709e9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/LivewireCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 9a709e9

Please sign in to comment.