You can resign and leave immediately but you may be breaching your employment contract, however, your employer can’t force you to work but might ask for compensation. Usually, employers expect at least a 2 weeks’ notice period so they can have enough time to find a replacement.