Guest User

Untitled

a guest
Oct 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. $mapps = Student_mapping::select('student_id');
  2.  
  3. if($request->session_id) {
  4. $mapps = $mapps->where('session', '=', $request->session_id);
  5. }
  6. if($request->class_id) {
  7. $mapps = $mapps->where('class_id', '=', $request->class_id);
  8.  
  9. if($request->group_id) {
  10. $mapps = $mapps->where('group_id', '=', $request->group_id);
  11.  
  12. if($request->section_id) {
  13. $mapps = $mapps->where('section_id', '=', $request->section_id);
  14. }
  15. }
  16. }
  17.  
  18. $mapps = $mapps->get();
  19.  
  20. $students = [];
  21.  
  22. foreach($mapps as $map) {
  23. if($map->student)
  24. {
  25. $students[] = Student::find($map->student_id);
  26. }
  27. }
Add Comment
Please, Sign In to add comment