engelsystem/src/Controllers/DesignController.php

65 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace Engelsystem\Controllers;
2021-04-10 17:02:34 +02:00
use Engelsystem\Config\Config;
use Engelsystem\Http\Response;
use Engelsystem\Models\User\State;
use Engelsystem\Models\User\User;
class DesignController extends BaseController
{
/** @var Response */
protected $response;
2021-04-10 17:02:34 +02:00
/** @var Config */
protected $config;
/**
* @param Response $response
2021-04-10 17:02:34 +02:00
* @param Config $config
*/
2021-04-10 17:02:34 +02:00
public function __construct(Response $response, Config $config)
{
2021-04-10 17:02:34 +02:00
$this->config = $config;
$this->response = $response;
}
/**
* Show the design overview page
*
* @return Response
*/
public function index()
{
$demoUser = (new User())->forceFill([
2021-04-10 17:02:34 +02:00
'id' => 42,
'name' => 'test',
]);
$demoUser->__set('state', (new State())->forceFill([
'user_id' => 42,
'arrived' => true,
]));
$demoUser2 = (new User())->forceFill([
2021-04-10 17:02:34 +02:00
'id' => 1337,
'name' => 'test2',
]);
$demoUser2->__set('state', (new State())->forceFill([
'user_id' => 1337,
'arrived' => false,
]));
$themes = $this->config->get('themes');
2021-04-10 17:02:34 +02:00
$data = [
'demo_user' => $demoUser,
'demo_user_2' => $demoUser2,
'themes' => $themes,
];
return $this->response->withView(
'pages/design',
2021-04-10 17:02:34 +02:00
$data
);
}
}