<?php
/**
 * Created by PhpStorm.
 * User: eater
 * Date: 4/10/16
 * Time: 9:30 PM
 */

namespace Eater\Glim\Handler\Panel\Servers\Edit;


use Eater\Glim\Handler\Session;
use Eater\Glim\Model\ServerQuery;

class Show extends Session
{
    protected $shouldHaveSuperuser = true;

    public function handle()
    {
        $server = ServerQuery::create()->findOneByFingerprint($this->attr('fingerprint'));

        if ($server === null) {
            return $this->getResponse()->withStatus(404);
        }

        return $this->render(
            "panel/servers/edit.html.twig",
            [
                'server' => $server
            ]
        );
    }
}