3502904656
Singleton в некоторых местах вместо решения #42. Новые шаги для решения #16 и #52. Closes #42. Closes #32. Closes #31.
26 lines
462 B
PHP
26 lines
462 B
PHP
<?php
|
|
/**
|
|
* Author: lopiu
|
|
* Date: 04.07.2020
|
|
* Time: 13:17
|
|
*/
|
|
namespace Battles\Models;
|
|
|
|
use Battles\Database\Db;
|
|
|
|
class PresentsModel
|
|
{
|
|
protected $DB;
|
|
|
|
public function __construct(int $user_id)
|
|
{
|
|
if (!$this->DB) {
|
|
$this->DB = Db::getInstance()->execute('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?', $user_id);
|
|
}
|
|
}
|
|
|
|
public function getAllPresents()
|
|
{
|
|
return $this->DB;
|
|
}
|
|
} |