model->findAll(); echo $this->viewer->render("shared/header.php"); echo $this->viewer->render("Products/index.php", [ "products"=> $products ]); } public function show(string $id) { $product = $this->model->find($id); if( $product == false ) { throw new PageNotFoundException("Product not found"); } echo $this->viewer->render("shared/header.php"); echo $this->viewer->render("Products/show.php", [ "product"=> $product ]); } public function showPage(string $title, string $id, string $page) { echo $title, " ", $id, " ", $page; } public function new() { echo $this->viewer->render("shared/header.php", [ "title" => "New Product" ]); echo $this->viewer->render("Products/new.php"); } public function create() { $data = [ "name" => $_POST["name"], "description" => empty($_POST["description"]) ? null : $_POST["description"] ]; var_dump($this->model->insert($data)); print_r($this->model->getErrors()); } }