private static function insert(Categorie $model) { $db = Database::getInstance('app'); $query = "INSERT INTO categories (name) VALUES (:name);"; $result = $db->prepare($query); $result->execute([':name' => $model->getName()]); $model->setId($db->lastId()); }
private static function insert(Categorie $model) { $db = Database::getInstance('app'); $query = "INSERT INTO categories (name,thumbnail,createdAt) VALUES (:name, :thumbnail, :createdAt);"; $result = $db->prepare($query); $result->execute([':name' => $model->getName(), ':thumbnail' => $model->getThumbnail(), ':createdAt' => $model->getCreatedAt()]); $model->setId($db->lastId()); }