| 12345678910111213141516171819202122232425 |
- <?php
- namespace Models;
- class TokenModel
- {
- private \PDO $pdo;
- public function __construct()
- {
- if (isset($GLOBALS['pdo']) && $GLOBALS['pdo'] instanceof \PDO) {
- $this->pdo = $GLOBALS['pdo'];
- return;
- }
- throw new \RuntimeException('Global PDO connection not initialized');
- }
- public function getByUf(string $uf): array
- {
- $stmt = $this->pdo->prepare('SELECT token_id, token_external_id, token_commodities_amount, token_commodities_value, token_uf, token_city, token_content, token_flag, wallet_id, chain_id, commodities_id, cpr_id, user_id FROM "token" WHERE token_uf = :uf ORDER BY token_id');
- $stmt->execute(['uf' => $uf]);
- return $stmt->fetchAll(\PDO::FETCH_ASSOC);
- }
- }
|