feat(admin): add coupon, order and review controllers

This commit is contained in:
dualfroz committed 2026-08-26 09:40:06 +02:00
1 parent bffd4c82c7
commit ed2f18bb14
3 files changed
+158

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
<?php
namespace Bazaar\Controllers\Admin;
use Bazaar\Controllers\Controller;
use Bazaar\Core\Response;
final class OrderController extends Controller
{
public function index(): Response
{
return $this->view('admin.orders.index', [
'orders' => $this->ctx->orders->all(),
], 'admin.layout');
}
public function show(string $id): Response
{
$order = $this->ctx->orders->find((int) $id);
if ($order === null) {
return $this->notFound();
}
return $this->view('admin.orders.show', [
'order' => $order,
'items' => $this->ctx->orders->items((int) $id),
], 'admin.layout');
}
public function fulfill(string $id): Response
{
try {
$this->ctx->orderService->markFulfilled((int) $id);
$this->ctx->session->flash('success', 'Order marked as fulfilled.');
} catch (\RuntimeException $error) {
$this->ctx->session->flash('error', $error->getMessage());
}
return $this->redirect('/admin/orders/' . (int) $id);
}
}