It was narrated from Ibn Abbas that the Messenger of Allah (ﷺ) said:
“Do not carry out the legal punishment in the mosque.”