Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Eager realationship in laravel

$parentLineCategories = ProductCategory::with([
            'children' => function ($child) use ($SpecificID) {
                return $child->with([
                    'products' => function ($product) use ($SpecificID) {
                        return $product->with([
                            'types' => function ($type) use ($SpecificID) {
                                return $type->where('id', $SpecificID);
                            }
                        ]);
                    }
                ]);
            }
        ])->get();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Eager #realationship #laravel
ADD COMMENT
Topic
Name
9+2 =