vendor categories fx8

This commit is contained in:
merdan 2022-11-18 15:54:55 +05:00
parent 31ad695706
commit e77e509b14
1 changed files with 16 additions and 0 deletions

View File

@ -54,4 +54,20 @@ class CategoryRepository extends WCategoryRepository
->groupBy('category_id') ->groupBy('category_id')
->get(); ->get();
} }
public function create(array $data){
$category = parent::create($data);
if (isset($data['vendors'])) {
$category->vendors()->sync($data['vendors']);
}
}
public function update(array $data, $id, $attribute = 'id'){
$category = parent::update($data,$id,$attribute );
if (isset($data['vendors'])) {
$category->vendors()->sync($data['vendors']);
}
}
} }