浏览代码

customer route cleanup

database
父节点
当前提交
bf963821ac
共有 3 个文件被更改,包括 1 次插入23 次删除
  1. 0
    20
      public/index.php
  2. 0
    2
      src/DB/Clients.php
  3. 1
    1
      templates/clients.html.twig

+ 0
- 20
public/index.php 查看文件

@@ -187,24 +187,4 @@ $app->get('/order/{id}', function (Request $request, Response $response, array $

$app->get('/customers', \Shop\Controller\Clients::class . ':clients');

// $app->get('/customers', function (Request $request, Response $response, array $args) {
// $db = new myDB();
// $sql = "SELECT * FROM clients";
// $stmt = $db->prepare($sql);
// $res = $stmt->execute();

// $response->getBody()->write("<h1>CUSTOMERS LIST </h1>");
// $response->getBody()->write('<hr/>');
// $response->getBody()->write("<table>");
// while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
// // maak hier een deftige tabel van
// $response->getBody()->write("<tr><td>" . " " . " <a href=\"/orders/" . $row['id'] . "\">" . $row["id"] . "</a> " . " " . $row['firstname'] . " " . $row['lastname'] . " " . $row['street'] . " " . $row['street2'] . " " . $row['zipcode'] . " " . $row['city'] . " " . $row['country'] . "</td></tr>");
// }
// $response->getBody()->write("</table>");

// return $response;
// });



$app->run();

+ 0
- 2
src/DB/Clients.php 查看文件

@@ -7,7 +7,6 @@ use Shop\Model\Clients as ClientModel;

class Clients extends myDB
{
protected $tableName;
protected $container;
protected $clients = [];

@@ -18,7 +17,6 @@ class Clients extends myDB

public function getClients()
{
$tableName = 'clients';
$stmt = $this->container->get('db')->prepare("SELECT * FROM clients;");
$res = $stmt->execute();
while($result = $res->fetchArray(SQLITE3_ASSOC)) {

+ 1
- 1
templates/clients.html.twig 查看文件

@@ -19,7 +19,7 @@
{% for clients in clients%}
<tr>
<td>
<a href="/orders/{{ client.id }}">{{ client.id }}</a>
<a href="/orders/{{ clients.id }}">{{ clients.id }}</a>
</td>
<td>{{ clients.firstname }}</td>
<td>{{ clients.lastname }}</td>

正在加载...
取消
保存