25 lines
549 B
PHP
25 lines
549 B
PHP
<?php
|
|
|
|
namespace Clan;
|
|
|
|
use Core\Db;
|
|
|
|
class ClanInfo
|
|
{
|
|
public static function isJoinable(string $name): bool
|
|
{
|
|
return Db::getValue('select count(name) from clan where name = ? and status = 1', [$name]) > 0;
|
|
}
|
|
|
|
public static function getNameById(int $id): string
|
|
{
|
|
$clan = self::getById($id);
|
|
return !empty($clan['name']) ? $clan['name'] : '';
|
|
}
|
|
|
|
public static function getById(int $id): array
|
|
{
|
|
return Db::getRow('select * from clan where id = ? and status = 1', [$id]) ?: [];
|
|
}
|
|
}
|