made events function in controller, edit links to database