diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e738ce9..e338f2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,3 +14,4 @@ jobs: uses: saucebase-dev/saucebase/.github/workflows/test-module.yml@main with: module: Demo + dependencies: saucebase/auth saucebase/settings saucebase/billing saucebase/announcements saucebase/blog saucebase/roadmap saucebase/themes diff --git a/app/Http/Controllers/DemoController.php b/app/Http/Controllers/DemoController.php index 546db63..3f10d73 100644 --- a/app/Http/Controllers/DemoController.php +++ b/app/Http/Controllers/DemoController.php @@ -4,6 +4,8 @@ use Inertia\Inertia; use Modules\Billing\Models\Product; +use Modules\Blog\Data\PostData; +use Modules\Blog\Models\Post; class DemoController { @@ -18,6 +20,16 @@ public function __invoke() $data['products'] = Product::displayable()->get(); } + if (app('modules')->isEnabled('Blog')) { + $posts = Post::published() + ->with(['category', 'author']) + ->orderByDesc('published_at') + ->limit(3) + ->get(); + + $data['latestPosts'] = $posts->map(fn (Post $post) => PostData::fromPost($post)); + } + return Inertia::render('Demo::Index', $data)->withSSR(); } } diff --git a/resources/js/pages/Index.vue b/resources/js/pages/Index.vue index 40b858f..a7b80cd 100644 --- a/resources/js/pages/Index.vue +++ b/resources/js/pages/Index.vue @@ -9,11 +9,13 @@ import { Head } from '@inertiajs/vue3'; import ProductSection from '@modules/Billing/resources/js/components/ProductSection.vue'; import type { Product } from '@modules/Billing/resources/js/types'; +import LatestPostsSection from '@modules/Blog/resources/js/components/LatestPostsSection.vue'; import HeroSection from './sections/HeroSection.vue'; import Testimonial from './sections/Testimonial.vue'; defineProps<{ products?: Product[]; + latestPosts?: Modules.Blog.Data.PostData[]; }>(); @@ -81,6 +83,7 @@ defineProps<{ +