Ejemplo n.º 1
0
 public function destroy($id)
 {
     $teach = Teach::with('presences')->find($id);
     if ($teach->presences->count() > 0) {
         Session::flash('message', 'Tidak dapat menghapus pertemuan!!');
     } else {
         Teach::destroy($id);
         Session::flash('message', 'Sukses mengupdate info Pertemuan');
     }
 }
Ejemplo n.º 2
0
 public function report($id)
 {
     $student = Issue::with('placement', 'receivable.installments', 'education', 'earnings', 'punishments', 'returnments', 'presences', 'points', 'retrievals', 'masteries')->find($id);
     $periods = Teach::with(array('presences' => function ($q) use($id) {
         $q->where('issue_id', '=', $id);
     }))->select(DB::raw('month(course_date) as months'), DB::raw('year(course_date) as years'))->groupBy(DB::raw('month(course_date)'))->get();
     $presences = array();
     foreach ($periods as $period) {
         $presences[] = array('month' => $period->months, 'year' => $period->years, 'presences' => $this->countPresences($id, $period->months, $period->years), 'presents' => $this->countPresents($id, $period->months, $period->years), 'absents' => $this->countAbsents($id, $period->months, $period->years), 'sicks' => $this->countSicks($id, $period->months, $period->years), 'permits' => $this->countPermits($id, $period->months, $period->years));
     }
     $points = array();
     foreach ($student->points as $point) {
         if ($point->pointable_type == 'Activity') {
             $points[] = array('date' => $point->pointable->agenda, 'event' => $point->pointable->name, 'point' => $point->point, 'lowest' => $this->getLowest($point->pointable_id), 'highest' => $this->getHighest($point->pointable_id));
         }
     }
     $menu = 'student';
     return View::make('students.report', compact('student', 'presences', 'points', 'menu'));
 }
Ejemplo n.º 3
0
 public function edit($id)
 {
     $teach = Teach::with('presences')->find($id);
     $menu = 'academic';
     return View::make('presences.edit', compact('teach', 'menu'));
 }