ConfigQuery.php 641 Bytes
<?php

namespace FootyRoom\Queries\Config;

use FootyRoom\Support\MongoClient;

class ConfigQuery
{
    /**
     * @var \FootyRoom\Support\MongoClient
     */
    protected $mongo;

    /**
     * Constructor.
     *
     * @param \FootyRoom\Support\MongoClient $mongo
     */
    public function __construct(MongoClient $mongo)
    {
        $this->mongo = $mongo->footyroom;
    }

    /**
     * Finds one configuration object by id.
     *
     * @param string $id
     *
     * @return \StdClass Configuration object
     */
    public function findById($id)
    {
        return $this->mongo->configs->findOne(['_id' => $id]);
    }
}