This commit is contained in:
pbao9
2026-02-07 16:18:39 +07:00
parent e7b9ce7485
commit 3dc19ccb83
11 changed files with 222 additions and 38 deletions
@@ -40,6 +40,10 @@ class ProductCategoryRepository extends BaseRepository implements ProductCategor
->select($select)
->with($relationships);
if (!empty($data['trashed'])) {
$query->onlyTrashed();
}
// if (!empty($data['vcenter_id'])) {
// $query->where('vcenter_id', $data['vcenter_id']);
// }
@@ -60,4 +64,21 @@ class ProductCategoryRepository extends BaseRepository implements ProductCategor
return $query->get();
}
public function restore(int $id)
{
$item = $this->model->withTrashed()->find($id);
if ($item) {
return $item->restore();
}
return false;
}
public function forceDelete(int $id)
{
$item = $this->model->withTrashed()->find($id);
if ($item) {
return $item->forceDelete();
}
return false;
}
}
@@ -13,4 +13,8 @@ interface ProductCategoryRepositoryInterface extends BaseRepositoryInterface
array $select = ['*'],
bool $returnQuery = false
);
public function restore(int $id);
public function forceDelete(int $id);
}