Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/ContentController.php
- This file was added.
<?php | |||||
namespace App\Http\Controllers; | |||||
use Illuminate\Routing\Controller; | |||||
class ContentController extends Controller | |||||
{ | |||||
/** | |||||
* Get the HTML content for the specified page | |||||
* | |||||
* @return \Illuminate\View\View | |||||
*/ | |||||
public function pageContent(string $id) | |||||
{ | |||||
if (empty($id) || !preg_match('/^[a-z]+$/', $id)) { | |||||
abort(404); | |||||
} | |||||
// TODO: Support sub-pages | |||||
$file = sprintf('themes/%s/pages/%s.blade.php', \config('app.theme'), $id); | |||||
$view = sprintf('%s.pages.%s', \config('app.theme'), $id); | |||||
if (!file_exists(resource_path($file))) { | |||||
abort(404); | |||||
} | |||||
return view($view)->with('env', \App\Utils::uiEnv()); | |||||
} | |||||
} |