I'm building an application where users can create 3 different type of tickets.
All ticket types have some common attributes like title, user, assigned_to, created_at, updated_at
But each ticket type has an own set of like 10 different additional attributes. One of them also has "has many" relation. Each of them also have common status attribute but values which it can take are different for each ticket type. Tickets gonna pass different phases depending on type too.
At first I planned to just make 3 different Eloquent models and SQL tables for each type of tickets.
But then I thought it would be nice for a user to have "my tickets" page where he can view all his tickets and their status in one common table like this:
| Title | Type | Status | User | Assigned To | Created at | Updated At |
But what's the best way to go about creating that table? Make 3 different queries, select common attributes, and merge the resulting collections? Sounds nice until I need to paginate it. Yes, I can paginate collection but it means I'm going to need to retrieve all the items from 3 tables each time before paginating.
Maybe I'm doing it all wrong and I should change my data model until it is not too late. I have an idea about making one ticket model with common attributes and splitting attributes that differ to 3 separate related tables. But I'm worried that it may make the process more complex, especially considering different statuses depending on type.
What do you think? Any advice?
Thanks.