i have multiple widgets on the page i'm giving the user the ability to load articles according to his choice, by selecting category subcategory then hitting the submit button.
i'm having some difficulties on how to make a this relationship work.
// these are the widgets widget 1 - id - Politics - contentcategory // this is the main category - contentsubcategory // this is the sub-cateogry widget 2 - id - sport - contentcategory - contentsubcategory widget 3 - id - lifestyle - contentcategory - contentsubcategory
The main and sub category are save into the widget table using simple form, now i need to perform the relationship to fetch the articles.
article 1 - id - title - category_id // this is the article main category - subcategory_id // this is the article sub-cateogry article 2 - id - title - category_id - subcategory_id article 3 - id - title - category_id - subcategory_id
i'm trying to get this type of relationship
$widget->category->subcategory->articles; widget has one category -> category has many subs -> sub has many articles
To achieve my purpose i need to make a relationship between these table so the widget main cat+subcat matches the article main cat +subcat.
How to perform this type of relationship, any idea ?????