Fix caching issue for '/' route

This commit is contained in:
Luca 2019-06-13 15:18:47 +02:00 committed by Igor Scheller
parent 6ed891fc04
commit 9232513831
2 changed files with 17 additions and 4 deletions

View File

@ -1,14 +1,11 @@
<?php <?php
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
use FastRoute\RouteCollector; use FastRoute\RouteCollector;
/** @var RouteCollector $route */ /** @var RouteCollector $route */
// Pages // Pages
$route->get('/', function () { $route->get('/', 'HomeController@index');
throw new HttpTemporaryRedirect(auth()->user() ? config('home_site') : 'login');
});
$route->get('/credits', 'CreditsController@index'); $route->get('/credits', 'CreditsController@index');
// Authentication // Authentication

View File

@ -0,0 +1,16 @@
<?php
namespace Engelsystem\Controllers;
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
class HomeController extends BaseController
{
/**
* @throws HttpTemporaryRedirect
*/
public function index()
{
throw new HttpTemporaryRedirect(auth()->user() ? config('home_site') : 'login');
}
}