public function delete($id) { if (!$this->isLogged()) { Header('Location: ' . $this->directories . '/users/login'); } if ($_SESSION['role'] != 'admin') { if ($_SESSION['role'] != 'editor') { Header('Location: ' . $this->directories . '/home/index'); } } $model = new Product(); $model->delete($id); Header('Location: ' . $this->directories . '/products/showAll'); }
public function products() { $model = new Product(); $products = []; if (count($_SESSION['cart']) > 0) { if (isset($_SESSION['cart'])) { foreach ($_SESSION['cart'] as $productId) { $product = $model->getProductById($productId); array_push($products, $product); } } } return new View($products); }