Answer the question
In order to leave comments, you need to log in
How to add additional inputs depending on a condition?
Friends, good afternoon, I do not know how to formulate the question more precisely. There is a site - an aggregator of events. It has several categories of events and the data that is required for the event, and this data differs depending on the category to which the event belongs.
For example:
Event: Exhibition of paintings . Category: Exhibitions . Required fields: Name, description, start-end date, price.
And another event:
Film. Category: Cinema . Required fields: Name, description, start-end date, price. + Cinema, start time in each cinema, price, etc.
That is, the option with a cinema is a differentiating event, respectively, on the presentation page, this whole thing needs to be displayed in a different format.
The question is.
How to properly organize the structure, adding an event?
I think to do this:
Add a separate CinemaEvent class inherited from the main Event. And process it on a separate route.
But the system works according to the pattern, and the category for the event is added via input=select in the event itself.
Also, please don't forget about the database. She works for . And all events are added to one Events table with a bunch of fields.
Any solution that you think is more logical and easily expandable is welcome., even if this solution has a radically different database, fs, and class schema. Thank you for attention.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question