public function getData()
 {
     $user = Auth::user();
     //User::find(1);
     $enrollments = Enrollment::where('student_id', '=', $user->id)->get();
     $available_sections = $user->getAvailableSections();
     //Vsection::All();
     $enrolled_sections = array();
     foreach ($enrollments as $e) {
         $enrolled_sections[] = Vsection::find($e->section_id);
     }
     $data = array("status" => "success", "enrolled_sections" => $enrolled_sections, "available_sections" => $available_sections);
     //echo $user->name;
     // echo "<pre>";
     // print_r($data);
     // print_r(json_encode($data));
     //$data = json_encode($data);
     return json_encode($data);
 }
Example #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($cid, $sid)
 {
     //echo $cid." ".$sid;
     $section = Vsection::find($sid);
     return view('sections.show')->with('section', $section);
 }
Example #3
0
 public function getEnrolledSections()
 {
     $enrolled_sections = array();
     $enrollments = Enrollment::where('student_id', '=', $this->id)->get();
     foreach ($enrollments as $e) {
         $enrolled_sections[] = Vsection::find($e->section_id);
     }
     return $enrolled_sections;
 }
Example #4
0
 public function showSections()
 {
     $sections = Vsection::all();
     return view('reports.allSections')->with('sections', $sections);
 }