The New South Wales state parliament passed the bills after the upper house approved the bill by 18 votes to eight.