Galaxy formation with L-GALAXIES: modelling the environmental dependency of galaxy evolution and comparing with observations