public function students() { $promos = Promo::all(); //Table input $select_year = array(); foreach ($promos as $promo) { $select_year[$promo->year] = 'Promotion ' . $promo->year; } return view('pages.students', compact('promos', 'select_year')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $promo = Promo::findOrFail($id); $promo->delete(); return redirect('admin/Promo'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $promos = Promo::orderBy('year')->pluck('year', 'id'); $student = Student::findOrFail($id); return view('admin.student.edit', compact('student', 'promos')); }