I have a mysql database diagram / structure like this:
Table Item as parent, and have 3 child table (ItemArticle, ItemElement, and ItemTool).
Every child should have parent parameter (warehouse_id and item_type_id). I am planning to connect table Item to children with item_id
How I make PHP class inheritance with this kind of database structure?
For example, if I make method getByItemId() then run the method, then PHP should return the class according to the item_type_id (If the item_type is article, then new ItemArticle())
I'm using Laravel framework.
EDIT: Earlier comments and suggestions from you, I think miss understanding from what I've been asking. So, please have a minute look at this link PHP Inheritance and MySQL
I wanted to have something like the checked mark answer. But don't know how to implement in my case.