Файловый менеджер - Редактировать - /home/skymarketplace/public_html/uploads/models.zip
Назад
PK �-�Z/�r r CartModel.phpnu �[��� <?php namespace App\models; use App\core\Database; class CartModel { protected \PDO $db; public function __construct() { $this->db = Database::connect(); } public function add($userId, $productId, $quantity): bool { $stmt = $this->db->prepare("INSERT INTO cart (user_id, product_id, quantity) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE quantity = quantity + VALUES(quantity)"); return $stmt->execute([$userId, $productId, $quantity]); } public function remove($userId, $itemId): bool { $stmt = $this->db->prepare("DELETE FROM cart WHERE user_id = ? AND id = ?"); return $stmt->execute([$userId, $itemId]); } public function getItems($userId): array { $stmt = $this->db->prepare("SELECT * FROM cart WHERE user_id = ?"); $stmt->execute([$userId]); return $stmt->fetchAll(\PDO::FETCH_ASSOC); } public function clear($userId): bool { $stmt = $this->db->prepare("DELETE FROM cart WHERE user_id = ?"); return $stmt->execute([$userId]); } } PK �-�Z HeroImage.phpnu �[��� PK �-�Z��<�P P HeroModel.phpnu �[��� <?php namespace App\Models; use PDO; class HeroModel { private PDO $db; public function __construct(PDO $db) { $this->db = $db; } public function insertHeroImage(string $imageName): bool { $stmt = $this->db->prepare("INSERT INTO hero_images (image) VALUES (:image)"); return $stmt->execute(['image' => $imageName]); } public function deleteHeroImage(int $id): bool { $stmt = $this->db->prepare("DELETE FROM hero_images WHERE id = :id"); return $stmt->execute(['id' => $id]); } } PK �-�Z�a303 3 LocationModel.phpnu �[��� <?php namespace App\models; use PDO; class LocationModel { private PDO $db; public function __construct(PDO $db) { $this->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]); } } PK �-�Z8b�~ ~ Notification.phpnu �[��� <?php namespace App\Models; use App\core\Database; class Notification { protected $db; public function __construct() { $this->db = Database::getInstance(); } public function deleteNotification($id) { $stmt = $this->db->prepare("DELETE FROM notifications WHERE id = ?"); return $stmt->execute([$id]); } } PK �-�Z"_� � Order.phpnu �[��� <?php namespace App\models; use App\core\Database; class Order { private $db; public function __construct() { $this->db = (new Database())->connect(); } public function changeStatus($id) { $stmt = $this->db->prepare("UPDATE orders SET status = 'changed' WHERE id = ?"); return $stmt->execute([$id]); } public function cancel($id) { $stmt = $this->db->prepare("UPDATE orders SET status = 'cancelled' WHERE id = ?"); return $stmt->execute([$id]); } public function deleteComplete($id) { $stmt = $this->db->prepare("DELETE FROM complete_orders WHERE id = ?"); return $stmt->execute([$id]); } public function deletePending($id) { $stmt = $this->db->prepare("DELETE FROM pending_orders WHERE id = ?"); return $stmt->execute([$id]); } public function deleteFromView($id) { $stmt = $this->db->prepare("DELETE FROM orders WHERE id = ?"); return $stmt->execute([$id]); } public function place($uid, $address, $price, $payment, $location_id, $note) { $stmt = $this->db->prepare("INSERT INTO orders (user_id, shipping_address, total_price, payment_method, delivery_location_id, order_note) VALUES (?, ?, ?, ?, ?, ?)"); return $stmt->execute([$uid, $address, $price, $payment, $location_id, $note]); } } PK �-�Z���/� � Search.phpnu �[��� <?php namespace App\Models; use App\core\Database; class Search { protected $db; public function __construct() { $this->db = Database::getInstance(); } public function performSearch($query) { $stmt = $this->db->prepare("SELECT * FROM products WHERE name LIKE ? OR description LIKE ?"); $stmt->execute(['%' . $query . '%', '%' . $query . '%']); return $stmt->fetchAll(); } } PK �-�ZF�T@j j UserModel.phpnu �[��� <?php namespace App\Models; use PDO; class UserModel { private PDO $db; public function __construct(PDO $db) { $this->db = $db; } public function deleteUserById(int $id): bool { $stmt = $this->db->prepare("DELETE FROM users WHERE id = :id"); return $stmt->execute(['id' => $id]); } } PK �-�Z/�r r CartModel.phpnu �[��� PK �-�Z � HeroImage.phpnu �[��� PK �-�Z��<�P P � HeroModel.phpnu �[��� PK �-�Z�a303 3 y LocationModel.phpnu �[��� PK �-�Z8b�~ ~ � Notification.phpnu �[��� PK �-�Z"_� � � Order.phpnu �[��� PK �-�Z���/� � i Search.phpnu �[��� PK �-�ZF�T@j j z UserModel.phpnu �[��� PK h !
| ver. 1.4 |
Github
|
.
| PHP 8.1.31 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка