public function run()
 {
     //nom, prenom, adresse, numTel, numCell, courriel, disponibilite, accreditation, verification
     $infos = [["Desrosiers", "Jérémi", "123 rue Duniquab, Drummondville, J2C 1A1", "8194771234", "8198181234", "*****@*****.**", "000A123", "À faire"], ["Pedneault", "Eric", "124 rue Petinichon, Drummondville, J2C 1A2", "8194772345", "8198182345", "*****@*****.**", "000B123", "En attente"], ["Girardin", "Simon", "125 rue Sainte-Paire, Drummondville, J2C 1A3", "8194773456", "8198183456", "*****@*****.**", "000C123", "Fait"], ["Lehoux", "Alexandre", "126 boul. Delamarde, Drummondville, J2C 1A4", "8194774567", "8198184567", "*****@*****.**", "000D123", "Fait"], ["Dubé", "Sarah", "127 rue Dunimportequoi, Drummondville, J2C 1A5", "8194775678", "8198185678", "*****@*****.**", "000E123", "Fait"]];
     DB::table('benevoles')->delete();
     foreach ($infos as $info) {
         $benevole = new Benevole();
         $benevole->nom = $info[0];
         $benevole->prenom = $info[1];
         $benevole->adresse = $info[2];
         $benevole->numTel = $info[3];
         $benevole->numCell = $info[4];
         $benevole->courriel = $info[5];
         $benevole->accreditation = $info[6];
         $benevole->verification = $info[7];
         $benevole->save();
     }
 }
 public function run()
 {
     $mois_courant = date("Y-m");
     $infos = [["0", "Sur appel seulement", "0", "04 10:00:00", "04 14:00:00"], ["1", "un rappel", "1", "06 08:00:00", "06 17:30:00"], ["2", "Sauf entre midi et 13h", "1", "07 08:00:00", "07 17:30:00"]];
     $benevoles = Benevole::all();
     DB::table('disponibilites')->delete();
     foreach ($infos as $info) {
         $disponibilite = new Disponibilite();
         $disponibilite->benevole_id = $benevoles[$info[0]]->id;
         $disponibilite->title = $info[1];
         $disponibilite->isAllDay = $info[2];
         $disponibilite->start = $mois_courant . "-" . $info[3];
         $disponibilite->end = $mois_courant . "-" . $info[4];
         $disponibilite->save();
     }
 }
 /**
  * update les disponibilités dans la base de données pour le bénévole sélectionné.
  *
  * @return Response
  */
 public function update()
 {
     if (Request::ajax()) {
         try {
             $input = Input::all();
             $disponibilite = Disponibilite::findOrFail($input['id']);
             if (isset($input['benevole_id'])) {
                 $benevole = Benevole::findOrFail($input['benevole_id']);
                 $disponibilite->benevole_id = $input['benevole_id'];
             }
             if (isset($input['title'])) {
                 $disponibilite->title = $input['title'];
             }
             if (isset($input['start'])) {
                 $disponibilite->start = strtotime($input['start']);
             }
             if (isset($input['end'])) {
                 $disponibilite->end = strtotime($input['end']);
             }
             if ($disponibilite->save()) {
                 $response = array('status' => 'success', 'msg' => 'La disponibilité a été modifiée avec succès.');
             }
         } catch (ModelNotFoundException $e) {
             $response = array('status' => 'fail', 'msg' => 'Impossible de modifier la disponibilité.');
         }
         return $response;
     } else {
         return App::abort(404);
     }
 }
 /**
  * Efface la ressource de la bd.
  *
  * @param  int  $id l'id du benevole à effacer
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $benevole = Benevole::findOrFail($id);
         $benevole->delete();
     } catch (ModelNotFoundException $e) {
         App::abort(404);
     }
     return Redirect::action('BenevolesController@index');
 }