24 lines
437 B
PHP
24 lines
437 B
PHP
<?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;
|
|
}
|
|
}
|