Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -102,4 +102,32 @@ class ProductRepository
|
||||
|
||||
return $result !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Przywraca produkt z archiwum (wraz z kombinacjami)
|
||||
*
|
||||
* @param int $productId ID produktu
|
||||
* @return bool Czy operacja się powiodła
|
||||
*/
|
||||
public function unarchive(int $productId): bool
|
||||
{
|
||||
$this->db->update( 'pp_shop_products', [ 'status' => 1, 'archive' => 0 ], [ 'id' => $productId ] );
|
||||
$this->db->update( 'pp_shop_products', [ 'status' => 1, 'archive' => 0 ], [ 'parent_id' => $productId ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Przenosi produkt do archiwum (wraz z kombinacjami)
|
||||
*
|
||||
* @param int $productId ID produktu
|
||||
* @return bool Czy operacja się powiodła
|
||||
*/
|
||||
public function archive(int $productId): bool
|
||||
{
|
||||
$this->db->update( 'pp_shop_products', [ 'status' => 0, 'archive' => 1 ], [ 'id' => $productId ] );
|
||||
$this->db->update( 'pp_shop_products', [ 'status' => 0, 'archive' => 1 ], [ 'parent_id' => $productId ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user