mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 21:45:55 +00:00
Custom domain support
This commit is contained in:
@@ -57,6 +57,22 @@ class DatabaseSubdomainRepository implements SubdomainRepository
|
||||
return $deferred->promise();
|
||||
}
|
||||
|
||||
public function getSubdomainByNameAndDomain(string $name, string $domain): PromiseInterface
|
||||
{
|
||||
$deferred = new Deferred();
|
||||
|
||||
$this->database
|
||||
->query('SELECT * FROM subdomains WHERE subdomain = :name AND domain = :domain', [
|
||||
'name' => $name,
|
||||
'domain' => $domain
|
||||
])
|
||||
->then(function (Result $result) use ($deferred) {
|
||||
$deferred->resolve($result->rows[0] ?? null);
|
||||
});
|
||||
|
||||
return $deferred->promise();
|
||||
}
|
||||
|
||||
public function getSubdomainsByUserId($id): PromiseInterface
|
||||
{
|
||||
$deferred = new Deferred();
|
||||
@@ -85,8 +101,8 @@ class DatabaseSubdomainRepository implements SubdomainRepository
|
||||
}
|
||||
|
||||
$this->database->query("
|
||||
INSERT INTO subdomains (user_id, subdomain, created_at)
|
||||
VALUES (:user_id, :subdomain, DATETIME('now'))
|
||||
INSERT INTO subdomains (user_id, subdomain, domain, created_at)
|
||||
VALUES (:user_id, :subdomain, :domain, DATETIME('now'))
|
||||
", $data)
|
||||
->then(function (Result $result) use ($deferred) {
|
||||
$this->database->query('SELECT * FROM subdomains WHERE id = :id', ['id' => $result->insertId])
|
||||
|
||||
Reference in New Issue
Block a user