groupBy('year')->pluck('year'); $tahun = $request->tahun; // Tangani filter tahun $sidangs = Sidang::whereIn(Sidang::raw('YEAR(created_at)'), $tahuns) ->when($tahun, function ($query, $tahun) { return $query->whereYear('created_at', $tahun); }) ->with(['mahasiswa', 'pengajuan.dosenPembimbing']); $sidangs = $sidangs->get(); return view('peserta-sidang', compact('no', 'tahun', 'tahuns', 'sidangs')); } /** * Store a newly created resource in storage. */ public function store(Request $request) { // } /** * Display the specified resource. */ public function show(string $id) { // } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { // } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } }