summaryrefslogtreecommitdiff
path: root/src/Controllers/HomeController.php
blob: e3989f818226e750b3b48db5bd89deee60d40de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

namespace Engelsystem\Controllers;

use Engelsystem\Config\Config;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;

class HomeController extends BaseController
{
    /**
     * @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;
    }

    /**
     * @throws HttpTemporaryRedirect
     */
    public function index()
    {
        throw new HttpTemporaryRedirect($this->auth->user() ? $this->config->get('home_site') : 'login');
    }
}