feat: tambah website publik dengan halaman beranda, tentang, dan kegiatan
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Activity;
|
||||
use App\Models\Division;
|
||||
use App\Models\User;
|
||||
|
||||
class PublicController extends Controller
|
||||
{
|
||||
public function home()
|
||||
{
|
||||
return view('public.home', [
|
||||
'totalAnggota' => User::where('status', 'aktif')->count(),
|
||||
'totalDivisi' => Division::count(),
|
||||
'kegiatan' => Activity::where('status', 'approved')
|
||||
->latest('start_date')->take(3)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function tentang()
|
||||
{
|
||||
return view('public.tentang', [
|
||||
'divisi' => Division::withCount('members')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function kegiatan()
|
||||
{
|
||||
return view('public.kegiatan', [
|
||||
'kegiatan' => Activity::where('status', 'approved')
|
||||
->latest('start_date')->paginate(9),
|
||||
]);
|
||||
}
|
||||
|
||||
public function kegiatanDetail(Activity $activity)
|
||||
{
|
||||
abort_if($activity->status !== 'approved', 404);
|
||||
|
||||
return view('public.kegiatan-detail', compact('activity'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user