DNSBlock
This commit is contained in:
7
app/Models/Client.php
Normal file
7
app/Models/Client.php
Normal 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
13
app/Models/Domain.php
Normal 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
15
app/Models/Order.php
Normal 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
7
app/Models/Server.php
Normal 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
23
app/Models/User.php
Normal 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
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user