Initial Kaffeekasse SaaS restart
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
use PDO;
|
||||
|
||||
final class TenantContext
|
||||
{
|
||||
public function __construct(private readonly PDO $pdo)
|
||||
{
|
||||
}
|
||||
|
||||
public function bySlug(string $slug): ?array
|
||||
{
|
||||
$statement = $this->pdo->prepare(
|
||||
'SELECT * FROM tenants WHERE slug = :slug LIMIT 1'
|
||||
);
|
||||
$statement->execute(['slug' => $slug]);
|
||||
$tenant = $statement->fetch();
|
||||
|
||||
return $tenant ?: null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user