parental
parental copied to clipboard
feat: add `toChildModel` method
It would be great if there was a toChildModel method that I can easily use to convert parent models to child models. Please let me know if you like the idea so I can create corresponding tests.
So this would be used if the class you're instantiating is the parent class, right? Something like:
$obj = new User(['type' => 'admin', ....]); // Instance of User class
$obj->toChildModel(); // Creates an instance of the Admin class, passing along the attributes
I think I like that.
Yep, exactly. I can add tests if you are okay with it 😊