File tree 5 files changed +56
-14
lines changed
5 files changed +56
-14
lines changed Original file line number Diff line number Diff line change
1
+ @php
2
+ /** @var \App\Entity\Post[] $posts */
3
+ @endphp
4
+
5
+
6
+ # Tomas Votruba
7
+
8
+ I help PHP companies to modernize their codebase,
9
+ increase profits and attract new talent.
10
+
11
+ To make this happen faster and at scale, I made Rector - software that handles instant upgrades and automated refactoring.
12
+
13
+ We provide an upgrade service to save you time and money.
14
+
15
+
16
+
17
+ # Blog posts
18
+
19
+ @foreach ($posts as $post )
20
+ ## {{ $post -> getTitle () } }
21
+
22
+ {!! $post -> getContent () ! !}
23
+
24
+ @endforeach
Original file line number Diff line number Diff line change 19
19
// include dots and slashes as well
20
20
->where ('slug ' , '.* ' );
21
21
22
+ Route::get ('llms.txt ' , \App \Http \Controllers \LlmsTxtController::class);
22
23
Route::redirect ('/rss.xml ' , '/rss ' );
24
+
23
25
Route::get ('/rss ' , RssController::class);
24
26
25
27
Route::get ('/thumbnail/{title}.png ' , ThumbnailController::class)
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace App \Http \Controllers ;
6
+
7
+ use App \Repository \PostRepository ;
8
+ use Illuminate \Http \Response ;
9
+ use Illuminate \Routing \Controller ;
10
+
11
+ final class LlmsTxtController extends Controller
12
+ {
13
+ public function __construct (
14
+ private readonly PostRepository $ postRepository
15
+ ) {
16
+ }
17
+
18
+ public function __invoke (): Response
19
+ {
20
+ $ response = response ()->view ('llms-txt ' , [
21
+ 'posts ' => $ this ->postRepository ->fetchAll (),
22
+ ])->header ('Content-Type ' , 'text/plain ' );
23
+
24
+ return $ response ;
25
+ }
26
+ }
Original file line number Diff line number Diff line change 11
11
12
12
final class PostController extends Controller
13
13
{
14
- public function __construct (
15
- private readonly PostRepository $ postRepository ,
16
- ) {
17
- }
18
-
19
- public function __invoke (string $ slug ): View |RedirectResponse
14
+ public function __invoke (string $ slug , PostRepository $ postRepository ): View |RedirectResponse
20
15
{
21
- $ post = $ this -> postRepository ->getBySlug ($ slug );
16
+ $ post = $ postRepository ->getBySlug ($ slug );
22
17
23
18
if ($ post ->getAlias () && $ post ->getAlias () !== $ slug ) {
24
19
return redirect ('/blog/ ' . $ post ->getAlias ());
Original file line number Diff line number Diff line change 12
12
13
13
final class RssController extends Controller
14
14
{
15
- public function __construct (
16
- private readonly PostRepository $ postRepository ,
17
- ) {
18
- }
19
-
20
- public function __invoke (): Response
15
+ public function __invoke (PostRepository $ postRepository ): Response
21
16
{
22
- $ posts = $ this -> postRepository ->fetchAll ();
17
+ $ posts = $ postRepository ->fetchAll ();
23
18
24
19
$ contents = view ('rss ' , [
25
20
'posts ' => $ posts ,
You can’t perform that action at this time.
0 commit comments