Start at login and show dock icon preferences

I have an app that’s main place is in the menu bar. However, in the preferences I want the user to be able to change whether or not the dock icon for the app is shown with a check box. I also want them to be able to select whether or not the app starts at login. I have no idea where to start with this code, so any help would be appreciated!