Home>
Summary

Tokyo Sports Facility Service

Laravel history is less than a month.
Based on the "Reservation from date and time of use" system in the above link when creating a product for job hunting after learning authentication and basic CRUD, a detuned usage application (reservation application) web application I'm trying to create a table, but I'm troubled by the definition of the table.

Environment

Laravel 6.5.0
Homestead
Database …… MariaDB

What you did or made for the question Simple wireframe

Activity diagram related to the question I want to ask this time

Table relationship diagram (to the end)

I want to ask

The column that was written out as necessary for processing like the activity diagram is the first normalization part at the lower left of the table relationship diagram.

Think about it yourself and feel that the relationship between the user and the facility will be many-to-many, and it is the upper part of the figure that I tried to define it, but understanding the table Add 5 columns to users or facilities in the reservation section, that is, reservation date/time, reservation number issued when applying, application date/time, and update (when application is changed) I thought it would be nice to create a separate table for the relation, or maybe I would like to point out some advice on whether there is a completely different definition.

Because it is a snake, the relationship between users and password_reset remains the default when Auth authentication is introduced.

  • Answer # 1

    I think only 3 tables are needed.
    (Column names and types are appropriate)

    The points are below

    No need for user_reservation

    If only reservation_time is used, the start time and end time will be unknown, so it will not be possible to search for free time (if there is a limit of one set per day)

    reservation_number is unnecessary by using id

    Replace time with begin/end and abolish date to make it easier to search for reservations within the desired time zone (and can handle cases that span dates)

    Although it is not considered, it is better to have something like a business hours table.