I have 3 tables in my Database
Category (id,name,status)
Subcategory(id,parent_category_id,name,status) (parent_category_id is passed as foreign key)
Post (id,title,subcategory_id,status) (sub_category_id passed as foreign key)
Know I want to make a relationship b/w these tables as per following conditions
whenever the status of category is in_active the child subcategories and posts should not display
Whenever the status of subcategory is in_active the all the posts having that subcategory_id should not display
Whenever the post status in in_active that post will not display
please suggest a good approach along with way to access the data