engelsystem/src/Controllers/HomeController.php

39 lines
769 B
PHP
Raw Normal View History

2019-06-13 15:18:47 +02:00
<?php
namespace Engelsystem\Controllers;
2019-06-14 04:05:38 +02:00
use Engelsystem\Config\Config;
use Engelsystem\Helpers\Authenticator;
2019-06-13 15:18:47 +02:00
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
class HomeController extends BaseController
{
2019-06-14 04:05:38 +02:00
/**
* @var Authenticator
*/
protected $auth;
/**
* @var Config
*/
protected $config;
/**
* @param Authenticator $auth
* @param Config $config
*/
public function __construct(Authenticator $auth, Config $config)
{
$this->auth = $auth;
$this->config = $config;
}
2019-06-13 15:18:47 +02:00
/**
* @throws HttpTemporaryRedirect
*/
public function index()
{
2019-06-14 04:05:38 +02:00
throw new HttpTemporaryRedirect($this->auth->user() ? $this->config->get('home_site') : 'login');
2019-06-13 15:18:47 +02:00
}
}