Added logs page to the panel

This commit is contained in:
Pinga 2023-08-29 11:08:35 +03:00
parent 4abca19ba3
commit 361ccb3a7e
8 changed files with 163 additions and 42 deletions

View file

@ -0,0 +1,18 @@
<?php
namespace App\Controllers;
use App\Models\RegistryTransaction;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Container\ContainerInterface;
class LogsController extends Controller
{
public function view(Request $request, Response $response)
{
$logModel = new RegistryTransaction($this->container->get('db'));
$logs = $logModel->getAllRegistryTransaction();
return view($response,'admin/logs/index.twig', compact('logs'));
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Pinga\Db\PdoDatabase;
class RegistryTransaction
{
private PdoDatabase $db;
public function __construct(PdoDatabase $db)
{
$this->db = $db;
}
public function getAllRegistryTransaction()
{
return $this->db->select('SELECT * FROM registryTransaction.transaction_identifier ORDER BY cldate DESC');
}
public function getRegistryTransactionById($id)
{
return $this->db->select('SELECT * FROM registryTransaction.transaction_identifier WHERE id = ?', [$id])->fetch();
}
}