我有vehicles
型号有car_id
,year
,license_plate
字段。Laravel 5.2:如何通过模型获得belongsTo?
我有Car
模型car_class_id
,car_brand_id
,name
字段。 汽车名称包含像(思域,帕杰罗等)
我有Car_brands
与name
字段。 (本田,丰田)
我有Car_classes
与name
字段。 (SUV,MPV,卡车等)
car_id
在vehicles
模型属于Car
模型。
car_class_id
属于car_classes
和car_brand_id
属于car_brands
我怎样才能获得车辆列表,其中有car_class名MPV?
我的关系很好的设计,或者我只是把汽车品牌名称和汽车类名称放在车辆表上?