34 lines
796 B
PHP
34 lines
796 B
PHP
<?php
|
||
|
||
use Core\Db;
|
||
|
||
/** Предметы которые никому не принадлежат. Не перепутай! */
|
||
class ItemModel
|
||
{
|
||
private $item;
|
||
public function __construct(int $id)
|
||
{
|
||
$this->item = Db::getRow('select * from items_main where id = ?', [$id]);
|
||
}
|
||
|
||
public static function getItemData(int $id): string
|
||
{
|
||
return Db::getValue('select data from items_main_data where items_id = ?', [$id]);
|
||
}
|
||
|
||
public function getName()
|
||
{
|
||
return $this->item['name'];
|
||
}
|
||
|
||
public function getImage()
|
||
{
|
||
return $this->item['img'];
|
||
}
|
||
|
||
public static function getNameById(int $id): string
|
||
{
|
||
$name = Db::getValue('select name from items_main where id = ?', [$id]);
|
||
return $name ?: '';
|
||
}
|
||
} |