/** * Add a student query * * @param Request $request * @return mixed */ public function addStudentQuery(Request $request) { $this->validate($request, ['courseCode' => 'required', 'description' => 'required|max:5000']); $query = ['rollNo' => Auth::guard('student')->user()->rollNo, 'courseCode' => $request['courseCode'], 'description' => $request['description']]; // Add the query to database StudentQuery::create($query); return redirect()->back(); }
/** * Resolve a student query * * @param Request $request * @return mixed */ public function resolveStudentQuery(Request $request) { $rollNo = $request['rollNo']; $courseCode = $request['courseCode']; $created_at = $request['created_at']; $response = $request['response']; // Resolve the query StudentQuery::where(['rollNo' => $rollNo, 'courseCode' => $courseCode, 'created_at' => $created_at])->update(['response' => $response]); return redirect()->back(); }