home/skymarketplace/public_html/models/LocationModel.php 0000644 00000002463 15003700201 0017533 0 ustar 00 db = $db;
}
public function insert(array $data): bool
{
$stmt = $this->db->prepare("INSERT INTO locations (country, town, delivery_price) VALUES (:country, :town, :price)");
return $stmt->execute([
'country' => $data['country'],
'town' => $data['town'],
'price' => $data['delivery_price']
]);
}
public function update(array $data): bool
{
$stmt = $this->db->prepare("UPDATE locations SET country = :country, town = :town, delivery_price = :price WHERE id = :id");
return $stmt->execute([
'country' => $data['country'],
'town' => $data['town'],
'price' => $data['delivery_price'],
'id' => $data['id']
]);
}
public function delete(int $id): bool
{
$stmt = $this->db->prepare("DELETE FROM locations WHERE id = :id");
return $stmt->execute(['id' => $id]);
}
public function deleteFooter(int $id): bool
{
$stmt = $this->db->prepare("DELETE FROM footer_locations WHERE id = :id");
return $stmt->execute(['id' => $id]);
}
}