public function getPointsSinceMinutes(Metric $metric, $minutes)
    {
        $queryType = $this->getQueryType($metric);

        $points = DB::select("SELECT DATE_FORMAT({$this->getMetricPointsTable()}.`created_at`, '%Y-%m-%d %H:%i') AS `key`, {$queryType} ".
            "FROM {$this->getMetricsTable()} INNER JOIN {$this->getMetricPointsTable()} ON {$this->getMetricsTable()}.id = {$this->getMetricPointsTable()}.metric_id ".
            "WHERE {$this->getMetricsTable()}.id = :metricId ".
            "AND {$this->getMetricPointsTable()}.`created_at` >= DATE_SUB(NOW(), INTERVAL :minutes MINUTE) ".
            "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
            "GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
            'metricId' => $metric->id,
            'minutes'  => $minutes,
        ]);

        return $this->mapResults($metric, $points);
    }
public function getPointsSinceMinutes(Metric $metric, $minutes)
    {
        $queryType = $this->getQueryType($metric);

        $points = DB::select("SELECT DATE_FORMAT({$this->getMetricPointsTable()}.`created_at`, '%Y-%m-%d %H:%i') AS `key`, {$queryType} ".
            "FROM {$this->getMetricsTable()} INNER JOIN {$this->getMetricPointsTable()} ON {$this->getMetricsTable()}.id = {$this->getMetricPointsTable()}.metric_id ".
            "WHERE {$this->getMetricsTable()}.id = :metricId ".
            "AND {$this->getMetricPointsTable()}.`created_at` >= DATE_SUB(NOW(), INTERVAL :minutes MINUTE) ".
            "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
            "GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
            'metricId' => $metric->id,
            'minutes'  => $minutes,
        ]);

        return $this->mapResults($metric, $points);
    }
public function getPointsSinceMinutes ( Metric $ metric , $ minutes ) { $ queryType = $ this -> getQueryType ( $ metric ) ; $ points = DB :: select ( "SELECT DATE_FORMAT({$this->getMetricPointsTable()}.`created_at`, '%Y-%m-%d %H:%i') AS `key`, {$queryType} " . "FROM {$this->getMetricsTable()} INNER JOIN {$this->getMetricPointsTable()} ON {$this->getMetricsTable()}.id = {$this->getMetricPointsTable()}.metric_id " . "WHERE {$this->getMetricsTable()}.id = :metricId " . "AND {$this->getMetricPointsTable()}.`created_at` >= DATE_SUB(NOW(), INTERVAL :minutes MINUTE) " . "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() " . "GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`" , [ 'metricId' => $ metric -> id , 'minutes' => $ minutes , ] ) ; return $ this -> mapResults ( $ metric , $ points ) ; }
Returns metrics since given minutes.

@param \CachetHQ\Cachet\Models\Metric $metric
@param int                            $minutes

@return \Illuminate\Support\Collection
Returns metrics since given minutes .