I have three tables. The structure is:
1. categories
id - integer
name - string
2. sub_Categories
id - integer
category_id - integer
name - string
3. sub_catergory_threes
id - integer
sub_Category_id - integer
name- string
Now I want to show three level categories like, Category and when hover on any category item, Sub Categories of that category shows and when hover on any SubCategory item, Sub_Categories_Three of that SubCategory shows
im using laravel eloquent here are My Models
Category Model
public function subcategories(){
return $this->hasMany('App\SubCategory');
}
SubCategory Model
public function subcategoriesthree(){
return $this->hasMany('App\SubCategoryThree');
}
public function category(){
return $this->belongsTo('App\Category');
}
SubCategoriesThree Model
public function subcategory(){
return $this->belongsTo('App\SubCategory');
}