feat(auth): add auth and account controllers
This commit is contained in:
1 parent
a595fd88ff
commit
fa11ab995c
2 files changed
+105
No files matched your search
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Bazaar\Controllers;
|
||||
|
||||
use Bazaar\Core\Response;
|
||||
|
||||
final class AccountController extends Controller
|
||||
{
|
||||
public function orders(): Response
|
||||
{
|
||||
return $this->view('account.orders', [
|
||||
'orders' => $this->ctx->orders->forUser($this->ctx->auth->id()),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(string $id): Response
|
||||
{
|
||||
$order = $this->ctx->orders->findForUser((int) $id, $this->ctx->auth->id());
|
||||
if ($order === null) {
|
||||
return $this->notFound();
|
||||
}
|
||||
|
||||
return $this->view('account.order', [
|
||||
'order' => $order,
|
||||
'items' => $this->ctx->orders->items((int) $id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user