Разбивка inf.php по классам.

This commit is contained in:
lopar
2020-07-06 00:16:22 +03:00
parent 3317ab845d
commit 461cec852d
7 changed files with 92 additions and 76 deletions
+15 -2
View File
@@ -7,7 +7,20 @@
class PresentsModel
{
public function getAllPresents($user_id) {
return db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
protected $DB;
public function __construct(int $user_id)
{
$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();
}
}