So, let's say I have basic Document
with title
, author
,link_to_file
properties and hasParentDocument
and hasChildDocument
recursive relations.
Now I want to extend my Document
into, let's say, 3 or MORE types: Letter
,Report
and Contract
, which can have their own unique properties (e.g. Letter
has sender
and reciever
, Contract
can have a some fields like valid_until
and such) in the addition to inherited ones.
And I want them all to still have title
property (inherited from Document
) and be able to have child-parent relations with eachother (Contract
can be parent of Letter
, which can be parent of another Contract
, which can be parent of Report
... etc.) without hardcoding it.
How do I implement this in laravel? I mean the extending thing. I'm aware of the fact that I can implement Letter
,Report
and Contract
as separate entities without having an ancestor class/entity.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire