parent
7443f9d74c
commit
216bf84a2c
|
|
@ -69,6 +69,10 @@ class AttributeGroupRepo
|
|||
public static function delete($id)
|
||||
{
|
||||
$group = AttributeGroup::query()->findOrFail($id);
|
||||
if ($group->attributes->count()) {
|
||||
throw New \Exception(trans('admin/attribute_groups.error_cannot_delete_attribute_used', ['attributes' => implode(', ', $group->attributes->pluck('id')->toArray())]));
|
||||
}
|
||||
$group->descriptions()->delete();
|
||||
$group->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class AttributeRepo
|
|||
public static function delete($id)
|
||||
{
|
||||
$attribute = Attribute::query()->findOrFail($id);
|
||||
$attribute->descriptions()->delete();
|
||||
$attribute->values()->delete();
|
||||
$attribute->delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
return [
|
||||
'index' => 'Attribute group',
|
||||
'create_at_groups' => 'Create attribute group',
|
||||
'error_cannot_delete_attribute_used' => 'Attribute Group used by attribute (ID: attributes), can not be deleted!'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
return [
|
||||
'index' => '属性组',
|
||||
'create_at_groups' => '创建属性组',
|
||||
'error_cannot_delete_attribute_used' => '属性组不能删除,由于该属性组被属性(属性ID: :attributes)使用'
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue