Пример #1
0
 public function getPropertiesAttribute()
 {
     $categoryProperties = CategoryProperty::select('id', 'category_id', 'name', 'type')->where('category_id', $this->category_id)->get()->toArray();
     foreach ($categoryProperties as $k => &$v) {
         $v['values'] = GoodsCategoryProperty::select('id', 'value')->where('goods_id', $this->id)->where('category_property_id', $v['id'])->get()->toArray();
     }
     return $categoryProperties;
 }