Source Code Docs

DocumentationController extends Controller
in package

Resource Controller for the Documentation views.

Tags
todo

add config options

Table of Contents

realtimeAsset()  : string
Return a media file for the realtime viewer.
show()  : View
Display the specified resource.
handle404()  : string
Check if the specified slug exists as a page.

Methods

realtimeAsset()

Return a media file for the realtime viewer.

public realtimeAsset(string $file) : string
Parameters
$file : string

filename relative to the source media path

Tags
throws
NotFoundHttpException

if the file could not be found

Return values
string

of the file contents

show()

Display the specified resource.

public show(string $slug[, bool $realtime = false ]) : View
Parameters
$slug : string

of the Markdown page to show

$realtime : bool = false

is it a realtime request for on-the-fly generation?

Tags
throws
Exception

if a required file is missing

uses
MarkdownPage
uses
MarkdownPageCollection
todo

add feature that re-compiles static html when the realtime viewer is active. This could work by comparing checksums or file sizes. The advantage of this is that the preview should match the result files to prevent unexpected behavior.

Return values
View

handle404()

Check if the specified slug exists as a page.

private handle404(string $slug) : string

If page is not found, we swap the slug out for a 404. This way the user's url is preserved, and we don't redirect to a 404 page which can be jarring for the user.

Parameters
$slug : string

to validate

Return values
string

$slug the same slug if it exists, else 404

Search results