<?php

namespace Drone\Controller;

use Cockpit\AuthController;

/**
 * Admin controller class.
 */
class Admin extends AuthController
{

  /**
   * Default index controller.
   */
  public function index()
  {
    if (!$this->app->module('cockpit')->hasaccess('drone', 'manage.view')) {
      return false;
    }

    $data = $this->app->module('drone')->fetchDeploys();

    return $this->render('drone:views/deploys/index.php', [
      'deploys' => $data['deploys'] ?? [],
      'building' => $data['building'] ?? FALSE,
      'build' => $data['build']
    ]);
  }

}