The laws are stated: Like poles repel each other. Unlike poles attract each other.
For more information, visit:
https://advancedmagnetsource.com/2019/05/07/fundamental-laws-magnetism/
Hope this helps; have a great day!