Commit awal: prototipe UI SIAKAD Untan

This commit is contained in:
Ariyutta
2026-10-24 11:45:32 +07:00
commit d9b9cb5c0f
477 changed files with 51958 additions and 0 deletions
@@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers;
use App\Support\Prototype\Sample;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
class PengumumanController extends Controller
{
public function index(): View
{
return view('pengumuman.index', ['items' => $this->visible()]);
}
public function show(int $id): View
{
$item = $this->visible()->firstWhere('id', $id);
abort_if($item === null, 404);
return view('pengumuman.show', ['item' => $item]);
}
/** Pengumuman terbit yang ditujukan ke semua pengguna atau ke role pengguna ini. @return Collection<int, array<string, mixed>> */
private function visible(): Collection
{
$audience = ['Semua pengguna', auth()->user()->role->label()];
return Sample::pengumuman()
->where('status', 'Terbit')
->filter(fn (array $item): bool => in_array($item['audiens'], $audience, true))
->sortByDesc('tanggal')
->values();
}
}