tighten / parental

Use single table inheritance in your Laravel app
MIT License
1.36k stars 98 forks source link

Using child model from parent. #133

Open algsupport opened 1 month ago

algsupport commented 1 month ago

Hello,

Thank you for the great project. I was trying to to find out what would be a good and clean aproach to retrieve a child model.

I have a user form where I give the user the option to select the type of the model. Then I would like to use that type to create a new entry in the database.

I have set $childTypes in the parent. And I was wondering if I can use it somehow to retrieve the child model I want to use.

I am currently using something like if type==x use child x etc.... I was thinking if there is a better way.