Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vinschi's avatar
Level 16

help with fullcalendar

Hi all, I'm trying to use fullcalendar js in my app and I have some problems, maybe somebody can help me. I installed the maddhatter/laravel-fullcalendar package, I followed the github page and I configured the providers and the aliases and I can successfully render in my dashboard a div with the calendar. Now the problem started, I have to add the events into the calendar. Assuming an user who wants to book something, the admin as to approve it. In the approve method I create the event in this way:

public function approve($id)
{
   $user = Auth::user();
   $feedbacks = Feedback::latest()->paginate(5);
   if($user->isAdmin==1)
   {
        $booking = Booking::findOrFail($id);
        $booking->approved = 1;
        $total = $booking->getTotal();
        $booking->total = $total;
        $booking->save();
        $booking->sendMail($booking->user);
        $bookings = Booking::all();
        flash('Booking approved','success');
        $events = [] ;
        $events[] = \Calendar::event(
            $booking->user->surname, //event title
             false, //full day
             $booking->fromDay, //start
             $booking->toDay, //end
           $booking->id //event-id
        );
            
       $calendar = \Calendar::addEvents($events)->setOptions([
            'firstDay' => 1])->setCallbacks([]);
            
       return view('dashboard', compact('bookings','user','calendar'));
  }
}

of course the approval works but I don't see anything in my calendar. Where am I wrong? Please be nice, it's my first app. Thanks,

0 likes
0 replies

Please or to participate in this conversation.