Support the ongoing development of →
posted 9 years ago
Last updated 2 years ago.

why not using jsut one model for cellphone and laptop and have a type_id property to distinguish between those? i think you'd be off the best with that.

you could then even create a method on the model or using a respository to get cellphones or laptops only.(Item::whereTypeId(Item::$TYPES->CELLPHONE)->get())

Last updated 2 years ago.

Try looking int single-table-inheritance - basically you define an abstract parent class and extend it with some specific subclasses that can encapsulate their unique attributes.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.