Skip to content

Include default eager loads

Compare
Choose a tag to compare
@chrissm79 chrissm79 released this 19 Apr 21:07
· 3 commits to v2.0.x since this release

If you're using the hasMany directive and you're connected model has default eager loading Lighthouse will now pull in those relations automatically.

For example, if you have a model:

class Post extends Model
{
    protected $with = ['comments'];
}

a schema like this:

type Post {
  author: [Comment!]! @hasMany
}

Lighthouse will automatically eager load the author relationship whenever a Post type is queried.