orderBy('tanggal', 'desc') ->paginate(10); $title = 'Pengumuman'; return view('pengumuman.index', compact('pengumuman', 'title')); } public function create() { $title = 'Buat Pengumuman'; return view('pengumuman.create', compact('title')); } public function store(StorePengumumanRequest $request) { $data = $request->validated(); $data['dibuat_oleh'] = Auth::id(); Pengumuman::create($data); return redirect()->route('pengumuman.index') ->with('success', 'Pengumuman berhasil ditambahkan.'); } public function edit(Pengumuman $pengumuman) { $title = 'Edit Pengumuman'; return view('pengumuman.edit', compact('pengumuman', 'title')); } public function update(UpdatePengumumanRequest $request, Pengumuman $pengumuman) { $pengumuman->update($request->validated()); return redirect()->route('pengumuman.index') ->with('success', 'Pengumuman berhasil diperbarui.'); } public function destroy(Pengumuman $pengumuman) { $pengumuman->delete(); return redirect()->route('pengumuman.index') ->with('success', 'Pengumuman berhasil dihapus.'); } }