luyadev/luya-module-admin

View on GitHub
src/controllers/UptimeController.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace luya\admin\controllers;

use luya\rest\Controller;
use Yii;

/**
 * Uptime Tests
 *
 * This controler is used for uptime status robots.
 *
 * In order to call this controller use `https://mydomain.com/admin/uptime`.
 *
 * @since 3.1.0
 * @author Basil Suter <git@nadar.io>
 */
class UptimeController extends Controller
{
    /**
     * Return an array with status indicators.
     *
     * @return array
     */
    public function actionIndex()
    {
        Yii::$app->db->open();

        return [
            'date' => time(),
            'db' => Yii::$app->db->isActive,
        ];
    }
}