Support the ongoing development of Laravel.io →
posted 5 years ago
Last updated 2 years ago.
0

You can create table 'seats' with (idbus, numoftheseat, available (true or false), like this you can get all available (or not) seats for each bus easy.. and number of this of course ( ->count() ).

Last updated 5 years ago.
0

Are you trying to establish how many seats are unreserved on a trip, or exactly which seats are unreserved on a trip?

Not to sound critical, but your tables have strange names - naming can contribute a lot to simplifying the thought process. Why not have tables like:

• Busses (with columns like capacity, license_number, etc.)

• Trips (columns like departure_time, arrival_time, destination, etc.) - each Bus has many Trips

• Seats (columns like seat_number, passenger_name) - each Trip has many Seats

Last updated 5 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.