battles/classes/Battles/Models/PresentsModel.php

30 lines
546 B
PHP

<?php
/**
* Author: lopiu
* Date: 04.07.2020
* Time: 13:17
*/
namespace Battles\Models;
use Exceptions\GameException;
class PresentsModel
{
protected $DB;
public function __construct(int $user_id)
{
if (!$this->DB) {
$this->DB = \db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
}
}
public function getAllPresents()
{
return $this->DB;
}
public function getPresentsSum()
{
return $this->DB->getNumRows();
}
}