2023-04-18 09:21:54 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use Core\Db;
|
|
|
|
|
|
2023-06-08 18:33:56 +00:00
|
|
|
|
/** Предметы которые никому не принадлежат. Не перепутай! */
|
2023-04-18 09:21:54 +00:00
|
|
|
|
class ItemModel
|
|
|
|
|
{
|
2023-06-08 18:33:56 +00:00
|
|
|
|
private $item;
|
|
|
|
|
public function __construct(int $id)
|
|
|
|
|
{
|
|
|
|
|
$this->item = Db::getRow('select * from items_main where id = ?', [$id]);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-18 09:21:54 +00:00
|
|
|
|
public static function getItemData(int $id): string
|
|
|
|
|
{
|
|
|
|
|
return Db::getValue('select data from items_main_data where items_id = ?', [$id]);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-08 18:33:56 +00:00
|
|
|
|
public function getName()
|
|
|
|
|
{
|
|
|
|
|
return $this->item['name'];
|
|
|
|
|
}
|
2023-04-18 09:21:54 +00:00
|
|
|
|
|
2023-06-08 18:33:56 +00:00
|
|
|
|
public function getImage()
|
|
|
|
|
{
|
|
|
|
|
return $this->item['img'];
|
|
|
|
|
}
|
2023-12-19 01:58:37 +00:00
|
|
|
|
|
|
|
|
|
public static function getNameById(int $id): string
|
|
|
|
|
{
|
|
|
|
|
$name = Db::getValue('select name from items_main where id = ?', [$id]);
|
|
|
|
|
return $name ?: '';
|
|
|
|
|
}
|
2023-04-18 09:21:54 +00:00
|
|
|
|
}
|