src/Execution/DataLoader/ModelRelationFetcher.php
protected function loadDefaultWith(EloquentCollection $collection): self
    {
        if ($collection->isEmpty()) {
            return $this;
        }

        $model = $collection->first();
        $reflection = new ReflectionClass($model);
        $withProperty = $reflection->getProperty('with');
        $withProperty->setAccessible(true);

        $with = array_filter((array) $withProperty->getValue($model), function ($relation) use ($model) {
            return ! $model->relationLoaded($relation);
        });

        if (! empty($with)) {
            $collection->load($with);
        }

        return $this;
    }
protected function loadDefaultWith(EloquentCollection $collection): self
    {
        if ($collection->isEmpty()) {
            return $this;
        }

        $model = $collection->first();
        $reflection = new ReflectionClass($model);
        $withProperty = $reflection->getProperty('with');
        $withProperty->setAccessible(true);

        $with = array_filter((array) $withProperty->getValue($model), function ($relation) use ($model) {
            return ! $model->relationLoaded($relation);
        });

        if (! empty($with)) {
            $collection->load($with);
        }

        return $this;
    }
protected function loadDefaultWith ( EloquentCollection $ collection ) : self { if ( $ collection -> isEmpty ( ) ) { return $ this ; } $ model = $ collection -> first ( ) ; $ reflection = new ReflectionClass ( $ model ) ; $ withProperty = $ reflection -> getProperty ( 'with' ) ; $ withProperty -> setAccessible ( true ) ; $ with = array_filter ( ( array ) $ withProperty -> getValue ( $ model ) , function ( $ relation ) use ( $ model ) { return ! $ model -> relationLoaded ( $ relation ) ; } ) ; if ( ! empty ( $ with ) ) { $ collection -> load ( $ with ) ; } return $ this ; }
Load default eager loads.

@param  \Illuminate\Database\Eloquent\Collection<\Illuminate\Database\Eloquent\Model>  $collection
@return $this
Load default eager loads .