Craft 3 version - How to get entries related to current category only (not children)
These two pages should help you from the Craft 3 docs

https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#relatedto 

https://docs.craftcms.com/v3/relations.html