33 lines
673 B
PHP
33 lines
673 B
PHP
<?php
|
||
/**
|
||
* Author: lopiu
|
||
* Date: 04.07.2020
|
||
* Time: 13:17
|
||
*/
|
||
|
||
class PresentsModel
|
||
{
|
||
protected $DB;
|
||
|
||
public function __construct(int $user_id)
|
||
{
|
||
if (!$this->DB) {
|
||
try {
|
||
$this->DB = db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
|
||
} catch (Exception $e) {
|
||
echo "<div class='debug'>class PresentsModel: Не прогрузилась база!</div>";
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
public function getAllPresents()
|
||
{
|
||
return $this->DB;
|
||
}
|
||
|
||
public function getPresentsSum()
|
||
{
|
||
return $this->DB->getNumRows();
|
||
}
|
||
} |