In laravel documentation it shows how to create polymorphic relations. but In my case I would like to do it for different primary key column types.
for example, I am developing a social network for stock market. user can follow other users and user can also follow stocks.
Table: Users
- id - increments (PK)
- name - string
- email - string
Table: Stocks
- symbol - string (PK)
- comapany_name - string
Table: Followings
- id - increments (PK)
- followable_id - what type? user_id is unsignedInt and symbol is string
- followable_type - [possible values: Users/Stocks]
what is best way to solve this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire