Closed PrasadChinwal closed 2 months ago
https://github.com/GuavaCZ/calendar?tab=readme-ov-file#authorization
Check this and follow the instructions there
Had the same issue here. Overwriting the authorize method solved it. Thank you @lukas-frey .
@lukas-frey @hrodrigues-belodigital Yes the solution works for some events in the calendar. It works for the events I retrieve from Model
(Blue and Green events in screenshots) but doesn't work for events of type Guava\Calendar\ValueObjects\Event
(Orange events in screenshots).
Here is my code for the events:
public function getEvents(array $fetchInfo = []): Collection|array
{
$availability = collect();
$schedule = \App\Models\InstructorSchedule::query()
->where('instructor_id', 5)
->get();
$start = Carbon::parse($fetchInfo['startStr']);
$end = Carbon::parse($fetchInfo['endStr']);
$week = CarbonPeriod::between($start, $end);
$week->forEach(function (Carbon $date) use ($schedule, $availability) {
foreach ($schedule as $scheduleItem) {
if ((int) $scheduleItem->day === $date->dayOfWeek()) {
$availability->push(
Event::make()
->title('Available')
->backgroundColor('#fbbf24')
->textColor('#78350f')
->start(Carbon::parse($date)->setTimeFromTimeString($scheduleItem->start_at))
->end(Carbon::parse($date)->setTimeFromTimeString($scheduleItem->end_at))
);
}
}
});
return collect()
->push(...$availability) // menu doesn't work for these events
->push(...Appointment::whereRelation('instructor', 'id', 5) // menu works for these events
->where('start_at', '>=', $start)
->where('end_at', '<=', $end)
->get()
);
}
Yeah, it can't work for that. It's not a model so there's nothing to edit.
@lukas-frey that totally makes sense. Thanks for the help.
What happened?
I am trying to implement the
edit
anddelete
actions when clicked on an event. I see the context menu with myview
,edit
anddelete
actions, unfortunately when I click them nothing happens (I briefly see the button disable).Weirdly I have a
create
action on thegetDateClickContextMenuActions
which works perfectly.How to reproduce the bug
Package Version
1.6.0
PHP Version
8.2
Laravel Version
11.20
Which operating systems does with happen with?
macOS, Windows
Notes