-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we set the type of model using the base model? #47
Comments
That's not really how you should think about using the type field. You should instantiate the concrete classes you want to create (using a if/else or switch statement) rather than setting the type. There are too many ways the pattern you describe could break. Suppose the Child classes has setters, getters, validation, save hooks etc. None of those are going to get called unless you create a Child class explicitly. |
@aiakane16 check my posible solution, It might help you #50 |
What about for using Laravel implicit binding? https://laravel.com/docs/5.7/routing#implicit-binding |
@jonspalmer, can I ask why this library has a |
@sarahmarshy |
can we set the type of model using the base model.
this one is failing to save unless i define a
protected static $singleTableType = 'test';
in the base model.
what will this do is it will resolve to that type of model when retreive again.
i want to avoid using if else statement to instantiate the child class.
The text was updated successfully, but these errors were encountered: