40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Pengumuman;
|
|
use Carbon\Carbon;
|
|
|
|
class PengumumanController extends Controller
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
$pengumuman = Pengumuman::orderBy('tanggal_pengumuman', 'desc')->paginate(6); // Pagination 6 per halaman
|
|
|
|
return view('user.pengumuman', compact('pengumuman'));
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
|
|
$pengumuman = Pengumuman::findOrFail($id);
|
|
|
|
$recentPengumuman = Pengumuman::where('id_pengumuman', '!=', $id)
|
|
->orderBy('tanggal_pengumuman', 'desc')
|
|
->limit(5)
|
|
->get();
|
|
|
|
return view('user.detail-pengumuman', compact('pengumuman', 'recentPengumuman'));
|
|
}
|
|
|
|
public function hero()
|
|
{
|
|
$pengumumanHero = Pengumuman::orderBy('tanggal_pengumuman', 'desc')->take(3)->get();
|
|
|
|
return view('user.index', compact('pengumumanHero'));
|
|
}
|
|
}
|