TIF_NGANJUK_E41220949/app/Http/Controllers/PengumumanController.php

47 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Informasi;
use Carbon\Carbon;
class PengumumanController extends Controller
{
public function index()
{
$pengumuman = Informasi::where('kategori_informasi','pengumuman')
->orderBy('tanggal_informasi','desc')
->paginate(6);
return view('user.pengumuman', compact('pengumuman'));
}
public function show($id)
{
$pengumuman = Informasi::where('kategori_informasi','pengumuman')
->where('id_informasi',$id)
->firstOrFail();
$recentPengumuman = Informasi::where('kategori_informasi','pengumuman')
->where('id_informasi','!=',$id)
->orderBy('tanggal_informasi','desc')
->limit(5)
->get();
return view('user.detail-pengumuman', compact('pengumuman','recentPengumuman'));
}
public function hero()
{
$pengumumanHero = Informasi::where('kategori_informasi','pengumuman')
->orderBy('tanggal_informasi','desc')
->take(3)
->get();
return view('user.index', compact('pengumumanHero'));
}
}