feat: tambah modul blog dengan resource Filament, halaman publik, dan PostSeeder
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Activity;
|
||||
use App\Models\Division;
|
||||
use App\Models\Post;
|
||||
use App\Models\User;
|
||||
|
||||
class PublicController extends Controller
|
||||
@@ -39,4 +40,18 @@ class PublicController extends Controller
|
||||
|
||||
return view('public.kegiatan-detail', compact('activity'));
|
||||
}
|
||||
|
||||
public function blog()
|
||||
{
|
||||
return view('public.blog', [
|
||||
'posts' => Post::published()->with('author')->latest('published_at')->paginate(9),
|
||||
]);
|
||||
}
|
||||
|
||||
public function blogDetail(Post $post)
|
||||
{
|
||||
abort_if(! $post->published_at || $post->published_at->isFuture(), 404);
|
||||
|
||||
return view('public.blog-detail', compact('post'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user