Merge branch 'master' of https://git.mcnd.ca/mcndave/lean
This commit is contained in:
commit
3550d9aaa7
|
@ -61,16 +61,19 @@ trait ControllerTrait {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function renderError(string $errorCode, ?array $variables = null) : ResponseInterface
|
||||||
|
{
|
||||||
|
return static::renderHtml(
|
||||||
|
$this->renderRawView("lean/error/{$errorCode}", $variables ?? [])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function renderDocumentation(string $filename) : ResponseInterface
|
public function renderDocumentation(string $filename) : ResponseInterface
|
||||||
{
|
{
|
||||||
return $this->renderMarkdown( file_get_contents(getenv("PROJECT_PATH") . "/meta/doc/$filename.md") );
|
return $this->renderMarkdown( file_get_contents(getenv("PROJECT_PATH") . "/meta/doc/$filename.md") );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirect(string $url, int $code = 302, array $headers = []) {
|
protected function redirect(string $url, int $code = 302, array $headers = []) {
|
||||||
if ($code === 302 && empty(array_change_key_case($headers, CASE_LOWER)['cache-control'])) {
|
|
||||||
$headers['cache-control'] = 'no-store';
|
|
||||||
}
|
|
||||||
|
|
||||||
return new RedirectResponse($url, $code, $headers);
|
return new RedirectResponse($url, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue