|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Hyde\Framework\Features\Templates; |
|
6
|
|
|
|
|
7
|
|
|
use Illuminate\Support\Collection; |
|
8
|
|
|
|
|
9
|
|
|
/** @internal */ |
|
10
|
|
|
final class Homepages |
|
11
|
|
|
{ |
|
12
|
|
|
public static function options(): Collection |
|
13
|
|
|
{ |
|
14
|
|
|
return new Collection([ |
|
|
|
|
|
|
15
|
|
|
'welcome' => self::welcome(), |
|
16
|
|
|
'posts' => self::posts(), |
|
17
|
|
|
'blank' => self::blank(), |
|
18
|
|
|
]); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public static function exists(string $page): bool |
|
22
|
|
|
{ |
|
23
|
|
|
return self::options()->has($page); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public static function get(string $page): ?PublishableContract |
|
27
|
|
|
{ |
|
28
|
|
|
return self::options()->get($page); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public static function welcome(): PublishableContract |
|
32
|
|
|
{ |
|
33
|
|
|
return new class extends PublishableView |
|
34
|
|
|
{ |
|
35
|
|
|
protected static string $title = 'Welcome'; |
|
36
|
|
|
protected static string $desc = 'The default welcome page.'; |
|
37
|
|
|
protected static string $path = 'resources/views/homepages/welcome.blade.php'; |
|
38
|
|
|
protected static ?string $outputPath = 'index.blade.php'; |
|
39
|
|
|
}; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public static function posts(): PublishableContract |
|
43
|
|
|
{ |
|
44
|
|
|
return new class extends PublishableView |
|
45
|
|
|
{ |
|
46
|
|
|
protected static string $title = 'Posts Feed'; |
|
47
|
|
|
protected static string $desc = 'A feed of your latest posts. Perfect for a blog site!'; |
|
48
|
|
|
protected static string $path = 'resources/views/homepages/post-feed.blade.php'; |
|
49
|
|
|
protected static ?string $outputPath = 'index.blade.php'; |
|
50
|
|
|
}; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public static function blank(): PublishableContract |
|
54
|
|
|
{ |
|
55
|
|
|
return new class extends PublishableView |
|
56
|
|
|
{ |
|
57
|
|
|
protected static string $title = 'Blank Starter'; |
|
58
|
|
|
protected static string $desc = 'A blank Blade template with just the base layout.'; |
|
59
|
|
|
protected static string $path = 'resources/views/homepages/blank.blade.php'; |
|
60
|
|
|
protected static ?string $outputPath = 'index.blade.php'; |
|
61
|
|
|
}; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|