-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.php
45 lines (42 loc) · 1.54 KB
/
config.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
36
37
38
39
40
41
42
43
44
45
<?php
use Illuminate\Support\Str;
return [
'baseUrl' => 'http://localhost:3000',
'production' => false,
'siteName' => 'Laravolt',
'siteDescription' => 'Platform untuk mengembangkan sistem informasi dalam 2 minggu',
'prettyUrls' => true,
'versions' => [
'v4' => '4.x',
'v5' => '5.x',
],
'defaultVersion' => 'v5',
'selectedVersion' => function ($page) {
return explode('/', $page->getPath())[2] ?? $page->defaultVersion;
},
'navigation' => require('navigation.php'),
'isActive' => function ($page, $path) {
return str_ends_with(trimPath($page->getPath()), trimPath($path));
},
'isDocs' => function ($page) {
return (explode('/', $page->getPath())[1] ?? null) === 'docs';
},
'isActiveParent' => function ($page, $menuItem) {
if (is_object($menuItem) && $menuItem->children) {
return $menuItem->children->contains(
function ($child) use ($page) {
return trimPath($page->getPath()) === trimPath($child);
}
);
}
},
'url' => function ($page, $path) {
return (Str::startsWith($path, 'http://') || Str::startsWith($path, 'https://')) ? $path : '/'.trimPath($path);
},
'isUrl' => function ($page, $path) {
return Str::startsWith($path, 'http://') || Str::startsWith($path, 'https://');
},
'link' => function ($page, $path) {
return $page->baseUrl.'/docs/'.$page->selectedVersion().'/'.$path.($page->prettyUrls ? '' : '.html');
},
];