Skip to content

Commit

Permalink
because of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mlantz committed Mar 13, 2024
1 parent 55b16e0 commit 55dcbd5
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
18 changes: 17 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@

Route::get('/up', function () {
return view('support::up');
});
});

if (! app()->environment(['staging', 'production'])) {
Route::get('/docs', function () {
$files = scandir(base_path('docs'));

foreach ($files as $file) {
if (! is_dir(base_path('docs/'.$file))) {
$sections[$file] = file_get_contents(base_path('docs/'.$file));
}
}

return view('support::docs', [
'sections' => $sections,
]);
});
}
38 changes: 38 additions & 0 deletions views/docs.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@extends('layouts.main')

@section('page-title', 'Application Docs')

@section ('app-content')
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="mt-5">
<h4 class="mb-0">
<span class="fa fa-book text-success fa-fw"></span>
Docs
</h4>
<div class="list-group mt-5">
@foreach ($sections as $section => $content)
<a href="#{{ Str::of($section)->snake()->replace('.md', '') }}" class="list-group-item list-group-item-action">{{ Str::of($section)->title()->replace('.md', '') }}</a>
@endforeach
<a href="/docs/api" class="list-group-item list-group-item-action">API Docs</a>
</div>
</div>
</div>
<div class="col-md-8">
<div class="mt-5">
@foreach ($sections as $section => $content)
<div id="{{ Str::of($section)->snake()->replace('.md', '') }}" class="card shadow-sm mb-5">
<div class="card-header">
{{ Str::of($section)->title()->replace('.md', '') }}
</div>
<div class="card-body">
{!! Str::of($content)->markdown() !!}
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
@stop

0 comments on commit 55dcbd5

Please sign in to comment.