User on website can post different post types. I know how it is implemented on WordPress but I don’ want to use antipatterns.
As the first step I have created Post model and migration.
Then I want User to have an ability to choose different Post type. For example it can be video, quote, note, blog post etc.
As I understand I need to have table for each Post type. Is it corrent? If so, then how can I make additional tables for each post type with relation to Post model?
For now I think it should looks like:
Post: id, post_type (name of model?), user_id
and then for Quote there will be additional data:
Quote: id, post_id, title, content...
Is it normal way of implementing this functionality? And how to make relation in Laravel models to make correct Eloquent queries?
Also, should I assign Category to Post or to Quote table?
I am a bit confused. Wanted to implement it like in WordPress but saw that this is not the best way and trying to figure out how to do it in the other way with multiple tables connected to one main Post table.