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()
)
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.
http://laravel.io/forum/02-17-2014-eloquent-single-table-inheritance
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community