Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Arslan's avatar

Simple Relation Help

I have 3 tables

Category SubCategory And Sub Child

Now i want to show sub childs having category and subcategory

Sub child table fields

id
category_id
sub_cat_id
title
slug 

My Sub Child Model Function

public function sub_category()
{
        return $this->hasManyThrough('App\Category','App\SubCategory', 'category_id', 'sub_cat_id');
}

How want to show sub child categories having category and sub category Help Needed

Here is my Model of sub child table

0 likes
2 replies
Arslan's avatar

Any Help Guys how can i show sub child categories having categories and sub categories

jimmck's avatar

@arslan Did you bother to search this site for information before you signed up yesterday? Its a commonly asked question. Is this a Laracasts site? I would think subscriptions would go that?

1 like

Please or to participate in this conversation.