nuwave / nuwave/lighthouse

Implement supplementary directives for all Eloquent relationship types

Open
#332 5 comments 28 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
3.5k
Forks
468
Avg merge
3h 9m
Merged PRs (30d)
2

Description

Is your feature request related to a problem? Please describe.

Many users have come up with use cases where they require some of the other relationship types of Eloquent, such as Polymorphic relationships or Pivot Relations. In many cases, they work fine without any directives or do also work when using @belongsTo or @hasMany, although edge cases do come up from time to time.

To clarify: Other relationship types still work without those directives. They can simply be declared as fields on the type without using any directives.

Describe the solution you'd like

Implement additional directives for Eloquent's other relationship types. I am sure we can
do some nice optimizations and make Lighthouse even more simple to use.

https://laravel.com/docs/eloquent-relationships#defining-relationships

Support

  • hasMany
  • belongsTo
  • hasOne
  • belongsToMany
  • hasOneThrough
  • hasManyTrough
  • morphTo
  • morphOne
  • morphMany
  • morphToMany
  • morphedByMany

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named in the issue. Start by comparing the existing Eloquent relationship directives with Laravel's relationship documentation, focusing on the unchecked morphedByMany type; done means the additional directive is implemented and its edge cases are covered consistently with the supported relationship directives.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, laravel, php
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.