nitiphone2021 Posted February 12, 2022 Share Posted February 12, 2022 Dear all, I am design hotel management system as below schema. Do you have any idea to improve it? to verify room status Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/ Share on other sites More sharing options...
Barand Posted February 12, 2022 Share Posted February 12, 2022 I have a room booking tutorial here, if it helps. 1 Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/#findComment-1594085 Share on other sites More sharing options...
nitiphone2021 Posted February 12, 2022 Author Share Posted February 12, 2022 it's a good tutorial but how can I get the available room? I tried to follow your logic but it's not work This is my sql query from laravel $load_room = DB::table('tb_reservation_room') ->rightJoin('tb_rooms', 'tb_rooms.id', '=', 'tb_reservation_room.room_id') ->select('tb_rooms.id', 'tb_rooms.room_name') ->whereDate('checkin_date','<',$checkin_date) ->whereDate('checkin_date','>',$checkin_date) ->get(); Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/#findComment-1594091 Share on other sites More sharing options...
Barand Posted February 12, 2022 Share Posted February 12, 2022 I don't speak laravelese but is that query trying to find a date that is both greater than and less than $checkin_date? Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/#findComment-1594092 Share on other sites More sharing options...
nitiphone2021 Posted February 12, 2022 Author Share Posted February 12, 2022 yes, both greater than and less than $checkin_date Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/#findComment-1594093 Share on other sites More sharing options...
nitiphone2021 Posted February 12, 2022 Author Share Posted February 12, 2022 first I tried this code will show all rooms in system select `tb_rooms`.`id`, `tb_rooms`.`room_name` from `tb_reservation_room` right join `tb_rooms` on `tb_rooms`.`id` = `tb_reservation_room`.`room_id` I tried this code but no any output select `tb_rooms`.`id`, `tb_rooms`.`room_name` from `tb_reservation_room` right join `tb_rooms` on `tb_rooms`.`id` = `tb_reservation_room`.`room_id` where `checkin_date` < '2022-02-12' Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/#findComment-1594094 Share on other sites More sharing options...
Solution Barand Posted February 12, 2022 Solution Share Posted February 12, 2022 1 hour ago, nitiphone2021 said: yes, both greater than and less than $checkin_date And you don't see a problem with that? For example 1 2 3 4 5 6 7 8 9 10 Underline any number above that is both less than 5 and greater than 5 Quote Link to comment https://forums.phpfreaks.com/topic/314551-database-design-for-hotel-management-system/#findComment-1594095 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.