File manager - Edit - /home/webapp69.cm.in.th/u69319090039/Shop39/public/assets/app/Controllers/Admin/SellerApprovalController.php
Back
<?php class SellerApprovalController extends Controller { public function index(): void { $db = Database::getInstance(); $sql = "SELECT sp.*, u.full_name, u.email FROM seller_profiles sp JOIN users u ON sp.user_id = u.id ORDER BY sp.id DESC"; $sellers = $db->query($sql)->fetchAll(); $this->render('admin/sellers/index', [ 'title' => 'อนุมัติร้านค้า', 'sellers' => $sellers ], 'admin'); } public function approve(string $id): void { $this->validateCsrf(); $sellerId = (int)$id; $sellerModel = new SellerProfile(); $sellerModel->update($sellerId, ['status' => 'approved', 'rejection_reason' => null]); Session::setFlash('success', 'อนุมัติร้านค้าเรียบร้อยแล้ว'); $this->redirect('admin/sellers'); } public function reject(string $id): void { $this->validateCsrf(); $sellerId = (int)$id; $reason = Security::sanitizeString($_POST['rejection_reason'] ?? 'ข้อมูลไม่ผ่านเกณฑ์'); $sellerModel = new SellerProfile(); $sellerModel->update($sellerId, ['status' => 'rejected', 'rejection_reason' => $reason]); Session::setFlash('warning', 'ปฏิเสธคำขอเปิดร้านค้าแล้ว'); $this->redirect('admin/sellers'); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings