-
Notifications
You must be signed in to change notification settings - Fork 3
/
routes.php
35 lines (30 loc) · 951 Bytes
/
routes.php
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
<?php
/**
* @author Alex Carrega <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
*/
/*
* Add route to the logo.
* Adds custom routes.
* @param Illuminate\Http\Request $request
* @return null
*/
App::before(function($request)
{
Route::get('/logo', function () {
$response = Response::make( \Backend\Models\BrandSettings::instance()->logo->output(), 200);
$response->header('Content-Type', 'image/png');
return $response;
});
$ctrl = new \Cms\Classes\Controller();
foreach (\AxC\DataManagement\Models\Route::published() as $route)
{
$language[] = (object)['code' => $route->language];
if ($route->language == '') $language = array_merge( $language, \RainLab\Translate\Models\Locale::get( ['code'] )->all() );
foreach ($language as $l)
Route::any("$l->code/$route->path", function () use ($ctrl, $route)
{
return $ctrl->run($route->page);
});
}
});