🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:Service.php
<?php class Service { private $db; public function __construct(){ $this->db = new Database; } // Get all services public function getServices(){ $this->db->query('SELECT * FROM services ORDER BY order_index ASC, id DESC'); return $this->db->resultSet(); } // Get services with pagination public function getServicesPaginated($limit, $offset){ $this->db->query('SELECT * FROM services ORDER BY order_index ASC, id DESC LIMIT :limit OFFSET :offset'); $this->db->bind(':limit', $limit); $this->db->bind(':offset', $offset); return $this->db->resultSet(); } // Get total count of services public function getServicesCount(){ $this->db->query('SELECT COUNT(*) as count FROM services'); $row = $this->db->single(); return $row ? $row->count : 0; } // Get service by ID public function getServiceById($id){ $this->db->query('SELECT * FROM services WHERE id = :id'); $this->db->bind(':id', $id); return $this->db->single(); } // Add Service public function addService($data){ $this->db->query('INSERT INTO services (title, description, icon, order_index) VALUES (:title, :description, :icon, :order_index)'); $this->db->bind(':title', $data['title']); $this->db->bind(':description', $data['description']); $this->db->bind(':icon', $data['icon']); $this->db->bind(':order_index', $data['order_index']); if($this->db->execute()){ return true; } else { return false; } } // Update Service public function updateService($data){ $this->db->query('UPDATE services SET title = :title, description = :description, icon = :icon, order_index = :order_index WHERE id = :id'); $this->db->bind(':id', $data['id']); $this->db->bind(':title', $data['title']); $this->db->bind(':description', $data['description']); $this->db->bind(':icon', $data['icon']); $this->db->bind(':order_index', $data['order_index']); if($this->db->execute()){ return true; } else { return false; } } // Delete Service public function deleteService($id){ $this->db->query('DELETE FROM services WHERE id = :id'); $this->db->bind(':id', $id); if($this->db->execute()){ return true; } else { return false; } } }
Save Changes
Cancel
Create New File
Create New Folder