public function add_info() { $groups = Group::all(); $students = Student::all(); $disps = Disp::all(); return view('students.add-info', ['groups' => $groups, 'students' => $students, 'disps' => $disps]); }
public function getModify(Request $request) { if ($request->has('type') && $request->get('type')) { $type = $request->get('type'); if ($type == 'save_as_graduated') { $this_year = date("Y") . "0000"; //毕业结果或者退学转学 并且 毕业时间为去年或者发证时间为去年 $stus = DB::select("select * from students WHERE (stu_type='毕业结业' OR stu_type='退学转学') AND ((graduate_date < {$this_year} AND graduate_date <> '') OR (certificate_date < {$this_year} AND certificate_date <> ''))"); foreach ($stus as $stu) { $json = json_encode($stu); $stu = json_decode($json, true); $stu['last_modify_by'] = Auth::user()->name . '(' . Auth::user()->email . ')'; if (Graduate::find($stu['id'])) { Graduate::destroy($stu['id']); Graduate::create($stu); Student::destroy($stu['id']); } else { Graduate::create($stu); Student::destroy($stu['id']); } } return view('graduate.manage')->withTips(['转存成功!']); } } else { return redirect()->back()->withErrors(["选择错误!"]); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $marks = Mark::create(['exam_id' => $request->exam_id, 'student_id' => $request->student_id, 'obt_marks' => $request->obt_marks]); $exams = Exam::find($request->exam_id); $students = Student::find($request->student_id); $marks->exams()->save($exams); $marks->students()->save($students); return redirect('principal/create#mark-tab')->withInput(); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $student = Student::find($id); return $this->response->item($student, new StudentTransformer()); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $student = Student::where('userId', Auth::user()->id)->first(); return view('student')->with('student', $student); }