/** * Store a newly created resource in storage. * * @return Response */ public function store() { $liste_abs = Request::get('liste'); if ($liste_abs != null) { foreach ($liste_abs as $val) { $abs1 = new Absence(); $abs1 = Absence::absenceExiste(Request::get('horaire_id')); foreach ($abs1 as $key) { $key->delete(); } } foreach ($liste_abs as $abs) { $absence = new Absence(); $absence->etudiant_id = $abs; $absence->horaire_id = Request::get('horaire_id'); $absence->justificatif_id = 1; $absence->save(); } /*Mail::send('/app/alert',['name'=>'ERP-ENSAT'], function($message) { $liste_abs = Request::get('liste'); foreach ($liste_abs as $abs ) { $em = Etudiant::find($abs); $message->to('*****@*****.**')->from('*****@*****.**')->subject('Alert d\'une absence'); } });*/ } return redirect('/app'); }
public function indexChef() { $filiere = Session::get('user')->filieres[0]; $etudiants_count = Filiere::nbreEtudiantByFiliere($filiere->id); $enseignants_count = Enseignant::count(); $etudiants = Etudiant::etudiants_plus_3_absences(); $promotions = $filiere->promos; $promos_count = count($promotions); $stats_cours = array(); $today = Carbon::now(); $liste = null; $j = 0; $absences_count = 0; if ($promos_count > 0) { foreach ($promotions as $promotion) { $absences_count = $absences_count + Filiere::nbreAbsencesByPromo($promotion->id); } } $stats_cours = array(); $today = Carbon::now(); for ($i = 0; $i < 10; $i++) { $nb = Absence::whereDate('created_at', '=', date("Y-m-d", strtotime($today)))->count(); date_add($today, date_interval_create_from_date_string('-1 days')); array_push($stats_cours, $nb); } return View('app/dashboardChef', ['etudiants_count' => $etudiants_count, 'enseignants_count' => $enseignants_count, 'absences_count' => $absences_count, 'promos_count' => $promos_count, 'etudiants' => $etudiants, 'statistics' => $liste[0], 'promotions' => $promotions, 'filiere' => $filiere, 'statistics' => $stats_cours]); }
public function postInsert(Request $request) { if ($request->get('ket') != "") { $absen = new Absence(); $piket = \DB::table('t_guru')->where('nama', $request->guru_piket)->first(); $absen->nis = $request->nis; $absen->kd_tahun_ajaran = $request->kd_tahun_ajaran; $absen->kd_periode_belajar = $request->kd_periode_belajar; $absen->kd_rombel = $request->kelas; $absen->hari = $request->hari; $absen->tanggal = $request->tgl; $absen->jam_datang = $request->jam_datang; $absen->menit_kesiangan = $request->menit_kesiangan; $absen->kd_piket = $piket->kd_guru; $absen->keterangan = $request->ket; $absen->save(); \Session::flash('success', 'Data berhasil ditambahkan'); } else { \Session::flash('error', 'Gagal tambah data, isi kolom keterangan'); } return redirect('home'); }
public function run() { for ($i = 0; $i < 20; $i++) { Absence::create(['child_id' => mt_rand(1, 50), 'from' => '2015-08-10 00:00:00', 'to' => '2015-08-27 23:59:59']); } }
public static function absenceExiste($id_hor) { $abs_existe = Absence::where('horaire_id', '=', $id_hor)->get(); return $abs_existe; }
public function showhoraire($id) { $etudiants_count = Etudiant::count(); $enseignants_count = Enseignant::count(); $absences_count = Absence::count(); $matieres_count = Matiere::count(); $etudiants = Etudiant::etudiants_plus_3_absences(); $matiere = Matiere::find($id); $horaires = $matiere->horaires; return View('app/statistiques_horaire', ['etudiants_count' => $etudiants_count, 'enseignants_count' => $enseignants_count, 'absences_count' => $absences_count, 'matieres_count' => $matieres_count, 'etudiants' => $etudiants, 'horaires' => $horaires]); }