From 2646adf160e9a21b1ce479ce142ac1445006d410 Mon Sep 17 00:00:00 2001 From: tuxarmy Date: Fri, 3 Apr 2026 05:08:41 +0700 Subject: [PATCH] feat: tambah website publik dengan halaman beranda, tentang, dan kegiatan --- app/Http/Controllers/PublicController.php | 42 ++++++++++++++ resources/views/public/home.blade.php | 55 +++++++++++++++++++ .../views/public/kegiatan-detail.blade.php | 46 ++++++++++++++++ resources/views/public/kegiatan.blade.php | 36 ++++++++++++ resources/views/public/layout.blade.php | 32 +++++++++++ resources/views/public/tentang.blade.php | 35 ++++++++++++ routes/web.php | 7 ++- 7 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 app/Http/Controllers/PublicController.php create mode 100644 resources/views/public/home.blade.php create mode 100644 resources/views/public/kegiatan-detail.blade.php create mode 100644 resources/views/public/kegiatan.blade.php create mode 100644 resources/views/public/layout.blade.php create mode 100644 resources/views/public/tentang.blade.php diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php new file mode 100644 index 0000000..99817d1 --- /dev/null +++ b/app/Http/Controllers/PublicController.php @@ -0,0 +1,42 @@ + 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')); + } +} diff --git a/resources/views/public/home.blade.php b/resources/views/public/home.blade.php new file mode 100644 index 0000000..9db51e8 --- /dev/null +++ b/resources/views/public/home.blade.php @@ -0,0 +1,55 @@ +@extends('public.layout') + +@section('title', 'Beranda') + +@section('content') + +{{-- Hero --}} +
+

Persegi

+

Organisasi Pemuda Desa Karangdadap

+

Kecamatan Kalibagor, Kabupaten Banyumas

+ + Kenali Kami + +
+ +{{-- Stats --}} +
+
+
{{ $totalAnggota }}
+
Anggota Aktif
+
+
+
{{ $totalDivisi }}
+
Divisi
+
+
+
{{ $kegiatan->count() }}
+
Kegiatan Terbaru
+
+
+ +{{-- Kegiatan Terbaru --}} +

Kegiatan Terbaru

+
+ @forelse($kegiatan as $item) + +
+ {{ $item->start_date->format('d M Y') }} +
+

{{ $item->title }}

+

{{ $item->description }}

+
+ @empty +

Belum ada kegiatan.

+ @endforelse +
+ +@if($kegiatan->count()) +
+ Lihat semua kegiatan → +
+@endif + +@endsection diff --git a/resources/views/public/kegiatan-detail.blade.php b/resources/views/public/kegiatan-detail.blade.php new file mode 100644 index 0000000..9c92509 --- /dev/null +++ b/resources/views/public/kegiatan-detail.blade.php @@ -0,0 +1,46 @@ +@extends('public.layout') + +@section('title', $activity->title) + +@section('content') + +← Kembali ke Kegiatan + +
+
+ {{ $activity->start_date->format('d M Y') }} + @if($activity->start_date->ne($activity->end_date)) + — {{ $activity->end_date->format('d M Y') }} + @endif +
+ +

{{ $activity->title }}

+ +

{{ $activity->description }}

+ +
+
+ Dibuat oleh: + {{ $activity->creator->name }} +
+
+ Peserta: + {{ $activity->participants->count() }} orang +
+ @if($activity->executed_at) +
+ Dilaksanakan: + {{ $activity->executed_at->format('d M Y') }} +
+ @endif +
+ + @if($activity->execution_notes) +
+
Catatan Pelaksanaan
+

{{ $activity->execution_notes }}

+
+ @endif +
+ +@endsection diff --git a/resources/views/public/kegiatan.blade.php b/resources/views/public/kegiatan.blade.php new file mode 100644 index 0000000..72575d1 --- /dev/null +++ b/resources/views/public/kegiatan.blade.php @@ -0,0 +1,36 @@ +@extends('public.layout') + +@section('title', 'Kegiatan') + +@section('content') + +

Kegiatan

+

Dokumentasi kegiatan organisasi Persegi

+ +
+ @forelse($kegiatan as $item) + +
+ {{ $item->start_date->format('d M Y') }} + @if($item->start_date->ne($item->end_date)) + — {{ $item->end_date->format('d M Y') }} + @endif +
+

{{ $item->title }}

+

{{ $item->description }}

+ @if($item->executed_at) + Terlaksana + @else + Akan Datang + @endif +
+ @empty +

Belum ada kegiatan.

+ @endforelse +
+ +
+ {{ $kegiatan->links() }} +
+ +@endsection diff --git a/resources/views/public/layout.blade.php b/resources/views/public/layout.blade.php new file mode 100644 index 0000000..b40dc54 --- /dev/null +++ b/resources/views/public/layout.blade.php @@ -0,0 +1,32 @@ + + + + + + @yield('title', 'Persegi') — Organisasi Pemuda Desa Karangdadap + + + + + + +
+ @yield('content') +
+ + + + + diff --git a/resources/views/public/tentang.blade.php b/resources/views/public/tentang.blade.php new file mode 100644 index 0000000..c12d903 --- /dev/null +++ b/resources/views/public/tentang.blade.php @@ -0,0 +1,35 @@ +@extends('public.layout') + +@section('title', 'Tentang Kami') + +@section('content') + +

Tentang Persegi

+

Organisasi Pemuda Independen Desa Karangdadap

+ +
+

+ Persegi adalah organisasi pemuda independen yang berdiri di Desa Karangdadap, + Kecamatan Kalibagor, Kabupaten Banyumas. Kami berkomitmen untuk mendorong partisipasi aktif + pemuda dalam pembangunan desa melalui kegiatan sosial, pendidikan, olahraga, dan budaya. +

+

+ Dengan prinsip transparansi, gotong royong, dan inovasi, Persegi hadir sebagai + wadah bagi pemuda desa untuk berkontribusi nyata bagi masyarakat. +

+
+ +

Divisi Organisasi

+
+ @foreach($divisi as $div) +
+

{{ $div->name }}

+

{{ $div->description }}

+ + {{ $div->members_count }} anggota + +
+ @endforeach +
+ +@endsection diff --git a/routes/web.php b/routes/web.php index 86a06c5..54fa156 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,7 @@ use Illuminate\Support\Facades\Route; -Route::get('/', function () { - return view('welcome'); -}); +Route::get('/', [\App\Http\Controllers\PublicController::class, 'home'])->name('home'); +Route::get('/tentang', [\App\Http\Controllers\PublicController::class, 'tentang'])->name('tentang'); +Route::get('/kegiatan', [\App\Http\Controllers\PublicController::class, 'kegiatan'])->name('kegiatan'); +Route::get('/kegiatan/{activity}', [\App\Http\Controllers\PublicController::class, 'kegiatanDetail'])->name('kegiatan.detail');