pengumuman user
This commit is contained in:
parent
bf7b9392f3
commit
c126073273
|
|
@ -2,9 +2,38 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Pengumuman;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class PengumumanController extends Controller
|
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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
@extends('user.template')
|
||||||
|
|
||||||
|
@section('title', 'Pengumuman')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="page-title">
|
||||||
|
<div class="container d-lg-flex justify-content-between align-items-center">
|
||||||
|
<h1 class="mb-2 mb-lg-0">Pengumuman</h1>
|
||||||
|
<nav class="breadcrumbs">
|
||||||
|
<ol>
|
||||||
|
<li><a href="{{ route('user.index') }}">Beranda</a></li>
|
||||||
|
<li class="current">Pengumuman</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div><!-- End Page Title -->
|
||||||
|
|
||||||
|
<!-- Blog Posts Section -->
|
||||||
|
<section id="blog-posts" class="blog-posts section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row gy-4">
|
||||||
|
|
||||||
|
@forelse ($pengumuman as $item)
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<article>
|
||||||
|
|
||||||
|
<div class="post-img">
|
||||||
|
@if ($item->gambar_pengumuman)
|
||||||
|
<img src="{{ asset('storage/' . $item->gambar_pengumuman) }}"
|
||||||
|
alt="{{ $item->judul_pengumuman }}" class="img-fluid">
|
||||||
|
@else
|
||||||
|
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="post-category">
|
||||||
|
<time datetime="{{ $item->tanggal_pengumuman }}">
|
||||||
|
{{ $item->tanggal_pengumuman ? \Carbon\Carbon::parse($item->tanggal_pengumuman)->translatedFormat('d F Y') : '-' }}
|
||||||
|
</time>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 class="title">
|
||||||
|
<a href="{{ route('user.detail-pengumuman', $item->id_pengumuman) }}">
|
||||||
|
{{ Str::limit($item->judul_pengumuman, 30) }}
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-start">
|
||||||
|
<div class="post-meta ms-2">
|
||||||
|
<p class="post-excerpt">
|
||||||
|
{{ Str::limit(strip_tags($item->isi_pengumuman), 120, '...') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div><!-- End post list item -->
|
||||||
|
@empty
|
||||||
|
<p class="text-center">Belum ada pengumuman tersedia.</p>
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section><!-- /Blog Posts Section -->
|
||||||
|
|
||||||
|
@endsection
|
||||||
Loading…
Reference in New Issue