public function run() { $regions = Region::all(); $roles = Role::all(); $items = [["Gates", "Bill", 14, 1, 1, 0, "2000-01-23", "123 rue Delatortue", "819-472-5555", "*****@*****.**"], ["Jobs", "Steve", 13, 2, 1, 0, "1980-06-28", "456 rue Dulapin", "819-473-5555", "*****@*****.**"]]; DB::table('delegues')->delete(); foreach ($items as $item) { $delegue = new Delegue(); $delegue->nom = $item[0]; $delegue->prenom = $item[1]; $delegue->region_id = $regions[$item[2]]->id; $delegue->role_id = $roles[$item[3]]->id; $delegue->accreditation = $item[4]; $delegue->sexe = $item[5]; $delegue->date_naissance = $item[6]; $delegue->adresse = $item[7]; $delegue->telephone = $item[8]; $delegue->courriel = $item[9]; $delegue->save(); } }
/** * Efface la ressource de la bd. * * @param int $id l'id du rôle à effacer * @return Response */ public function destroy($id) { try { $delegue = Delegue::findOrFail($id); $delegue->delete(); } catch (ModelNotFoundException $e) { App::abort(404); } return Redirect::action('DeleguesController@index'); }