From e56b3c527ab7dc86d69059449945e43ec73d8903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Rigo?= Date: Thu, 14 Nov 2024 09:50:02 +0100 Subject: [PATCH] docs: add blade example --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 7e35902..e21fc2b 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,51 @@ export default defineComponent({ ``` +#### Laravel Blade + +```php +class ChangelogController +{ + public function __invoke() + { + $changelog = DB::table(config('changelog-commit-for-laravel.table_name')) + ->select('message', 'date') + ->orderBy('date', 'desc') + ->paginate(10); + + // Group by date + $groupedChangelog = $changelog->getCollection()->groupBy('date'); + + return view('changelog', [ + 'groupedChangelog' => $groupedChangelog, + 'pagination' => $changelog // Pass pagination object + ]); + } +} +``` + +```html +
+ @foreach ($groupedChangelog as $date => $items) +

+ {{ \Carbon\Carbon::parse($date)->translatedFormat('l d M Y') }} +

+ + @endforeach + + {{-- Laravel Pagination Links --}} +
+ {{ $pagination->links() }} +
+
+``` + ## Testing ```bash