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

KikoLdasd's avatar

Movie booking application

Okay, so I created 3 tables in the database. The first table has hourly intervals that are every 10 minutes in a day and a table shows where you can get tickets. My question is, how can I make that day or somehow create a calendar that has those intervals and if an interval was selected by a user it should not be used on that date ? For example, I have today and the 8:10 interval, I took that interval and I would like to save somewhere and know if I could do that.

  public function up()
    {
        Schema::create('ticket_office', function (Blueprint $table) {
            $table->id();
            $table->string('ticket_office')->nullable(); // ca be ticket_office_1, ticket_office_2 max 6
            $table->string('type')->nullable(); // horror etc
            $table->timestamps();
        });
    }
public function up()
    {
        Schema::create('intervals', function (Blueprint $table) {
            $table->id();
            $table->string('intervals')->null(); //can be 8:10, 8:20 to 16:50
            $table->timestamps();
        });
    }

My question is

Create a new table with retrieved intervals and save today's date + that day's interval? I mention that I want to have 6 ticket rooms. How should I proceed to be able to take over the interval and today's date, to save them in the fixed database with that interval? Is such a thing possible? As in this case I could put a condition.

0 likes
1 reply
Tray2's avatar

I would go with a schedule where I add the movies and the times they are showing.

Something like this

Cinemas table

  • name
  • address

Movies table

  • title
  • duration
  • blurb

Schedule

  • movies_id
  • room_id
  • starttime
  • cinema_id

Then I have a rooms table

  • room
  • cinema_id
  • seats

And lastly a tickets table

  • schedule_id
  • seat
  • user_id

So if the a ticket is bought you add the user id of the customer.

1 like

Please or to participate in this conversation.