This commit is contained in:
Halbe Bruno
2025-12-05 19:40:39 -03:00
commit f37bc712e6
4312 changed files with 359196 additions and 0 deletions

7
app/Models/Client.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
namespace App\Models;
use App\Core\Model;
class Client extends Model
{
protected $table = 'clients';
}

13
app/Models/Domain.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use App\Core\Model;
class Domain extends Model
{
protected $table = 'domains';
public function countBlocked()
{
$stmt = $this->conn->query("SELECT COUNT(*) as total FROM domains WHERE status = 'blocked'");
return $stmt->fetch()['total'];
}
}

15
app/Models/Order.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use App\Core\Model;
class Order extends Model
{
protected $table = 'orders';
public function recent($limit = 5)
{
$stmt = $this->conn->prepare("SELECT * FROM orders ORDER BY id DESC LIMIT :limit");
$stmt->bindValue(':limit', $limit, \PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetchAll();
}
}

7
app/Models/Server.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
namespace App\Models;
use App\Core\Model;
class Server extends Model
{
protected $table = 'servers';
}

23
app/Models/User.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use App\Core\Model;
class User extends Model
{
protected $table = 'users';
public function create($data)
{
$sql = "INSERT INTO users (name, email, password, role, client_id) VALUES (:name, :email, :password, :role, :client_id)";
$stmt = $this->conn->prepare($sql);
return $stmt->execute([
'name' => $data['name'],
'email' => $data['email'],
'password' => password_hash($data['password'], PASSWORD_DEFAULT),
'role' => $data['role'] ?? 'client',
'client_id' => $data['client_id'] ?? null
]);
}
}