Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
display available rooms and booked rooms in each day in fullcalander

i trying to create hotel room booking system using laravel and fullcalander. enter image description here

i am currently displaying all rooms in the hotel using one color and booked rooms in another color. i recieved those data using 2 json objects. i need to know is how to display only available rooms and booked rooms insted display all rooms and booked rooms. (this is my first project in laravel)

this is controller

 $booked_rooms = array();
    $bookings = Booking::all();
   
    
    foreach($bookings as $booking){

       $booked_rooms[]=[

       'title'=>$booking->room_number,
       'start'=>$booking->checkin_date,
       'end'=>$booking->checkout_date
       

       ];

    }

   
    $available_rooms = array();
    $rooms = tbl_room::all();
    foreach($rooms as $room){

        $available_rooms[]=[

        'title'=>$room->room_number,
        'start'=>'2022-01-01',
        'end'=>'2023-06-16'
       
        
        ];
     }

    return view('calander.view_calander',['booked_rooms'=>$booked_rooms],['available_rooms'=>$available_rooms]);

this is my script

<script>
     var available_rooms  = @json($available_rooms);
     var booked_rooms  = @json($booked_rooms);
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calander');

var calendar = new FullCalendar.Calendar(calendarEl, {

eventSources: [
{"events":booked_rooms,
 "color":"green"   
},
{
 "events":available_rooms,
 "color":"brown"
}

],
});

calendar.render();

});

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!