<?php

namespace App\Providers;

use App\Models\Post;
use Illuminate\Support\ServiceProvider;
use Inertia\Inertia;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
//
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Inertia::share([
            'runPosts' => fn () => Post::with(['kategori', 'subkategori'])
                ->where('IsPublish', true)
                ->orderBy('created_at', 'desc')
                ->get(),
        ]);
    }
}
