Files
cachet-docker/app/Composers/MetricsComposer.php
2016-06-02 10:16:23 +01:00

38 lines
839 B
PHP

<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Composers;
use CachetHQ\Cachet\Models\Metric;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Config;
class MetricsComposer
{
/**
* Metrics view composer.
*
* @param \Illuminate\Contracts\View\View $view
*
* @return void
*/
public function compose(View $view)
{
$metrics = null;
if ($displayMetrics = Config::get('setting.display_graphs')) {
$metrics = Metric::displayable()->orderBy('order')->get();
}
$view->withDisplayMetrics($displayMetrics)
->withMetrics($metrics);
}
}