From 69007cb918189a63334848fd9c72cf16f2157e96 Mon Sep 17 00:00:00 2001
From: filippo.bertilotti <filippobertilotti@gmail.com>
Date: Fri, 24 May 2024 10:53:49 +0200
Subject: [PATCH] inizializzazione metodo per eliminare un prodotto dal database

---
 src/App/Models/product.php |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/App/Models/product.php b/src/App/Models/product.php
index 83a38d6..c58f802 100644
--- a/src/App/Models/product.php
+++ b/src/App/Models/product.php
@@ -5,5 +5,13 @@
     use PDO;
     use Framework\Model;
     class Product extends Model {
-        protected ?string $table = "product";
+        //protected ?string $table = "product";
+        
+
+        protected function validate(array $data): void {
+            
+            if(empty($data["name"])) {
+                $this->addError("name","Name is required");
+            }
+        }
     }
\ No newline at end of file

--
Gitblit v1.8.0