Giter VIP home page Giter VIP logo

lighthouse-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lighthouse-example's Issues

Index from Directive

how can generate the current index from field directive ? need this for get the order from query

`
namespace App\GraphQL\Directives;

use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\Schema\Directives\BaseDirective;
use Nuwave\Lighthouse\Schema\Values\FieldValue;
use Nuwave\Lighthouse\Support\Contracts\FieldResolver;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;

class RankDirective extends BaseDirective implements FieldResolver
{
public function resolveField(FieldValue $fieldValue)
{
return $fieldValue->setResolver(function ($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) {
return $root->id;
});
}
}
`

Relationships returning null.

I used lighthouse in my own project, but I couldn't get the eloquent relationship directives to work. I am running this example project and I am encountering the same problem.

The only change I made in the lighthouse-example project is that I used the resolver for the jobs list in the schema.graphql file.
2
1

I have no issues querying the Models through tinker with their relationships. I can supply more information. I'm going to investigate this, but I wonder if other people have had this issue before.

I did a DB::Listen to log the output of the sql statements, I'll attach the file for a single call to the graphql call pictured above.
laravel.log

Can't create job - Class name must be a valid object or a string

Hi,

Many thanks for your great work. I've just started with this great package and trying to follow your tutorial, but I'm having issue with "createJob". Just cloned your repo and didn't change anything except the .env file.

Bellow you can all individual steps to replicate my problem.

git clone https://github.com/nuwave/lighthouse-example.git
cd lighthouse-example
composer install
cp .env.example .env

I've entered login details for my local database into the .env file

I've generated key and started the server

php artisan key:generate
php artisan db:seed
php artisan serve

Called with graphQL client

mutation {
  login(username: "[email protected]", password: "secret", client_id: 2, client_secret: "MIW7eh1y61upQPIEfa1nIV1sIls1XIYltxB7Ra5q") {
    auth_token {
      access_token
    }
  }
}

got response

{
	"data": {
		"login": {
			"auth_token": {
				"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Ijk3Y2ZhMTRmMmE4OGVlNzgwMDFhYTFmMDllZjY5OTQ0MzBhNGJhZmUzZjcxNzAxNGI1ZmFlYjZiNjE1ZDg3YWIxN2I3ZGQ4YThjZmEzM2MwIn0.eyJhdWQiOiIyIiwianRpIjoiOTdjZmExNGYyYTg4ZWU3ODAwMWFhMWYwOWVmNjk5NDQzMGE0YmFmZTNmNzE3MDE0YjVmYWViNmI2MTVkODdhYjE3YjdkZDhhOGNmYTMzYzAiLCJpYXQiOjE1MzQ5MzAyODMsIm5iZiI6MTUzNDkzMDI4MywiZXhwIjoxNTY2NDY2MjgzLCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.Tq86azoL1J15Rzlcsfqu2xkqtKu7xstfOcVfynza_8QXerq6lQgEiVhMSJzqWwsqfA8TGbc9zYD6W1iWmwvIPVybYmmKvjqhz3VjRQQS5wQP065rzlVZC6rg6LWE3f5kkcQH8eXa13pwKOhgBeZy0ItTgmygghebmxDTM6zpcRT4IC9Ga8wvaBqu9g2nM-IrwC6mg4ZdLYgpEgyWKErn4Gcs0h3rtPkSvbCTouZIgm1mKULg6n-BFV2wqHqlh2WeqJKgsKnZQ57tpbPHUZk_3sJwSD-NiPJPr2XNzd9vSwqEPkXXND5z0pUIyrdIehTdaL_m5ik-GEdrVdZTfPvBi8YUp6rNwPdvvXzO2dVD0wUVM1i1uZaDxbHPd1LXqA3D93gDpnKcewXPTkRdTl9VlI94XA7z41nvdKiPiM9BT8ERzh8vrpsi-SvqeztEn1ew6GbJAFw2sW9TOqSSrfFcEqg3jGe8cwzYJPcN5y3O_YLbaFccMcYiI4DhpqaIe0mmoF6UninBkSws1DJcgKG85DvyFLs4XRolb09H6VqckcfOrCbudXMm6XX3ABJi60276Uu6jtTv-pY-sk9x2YeL-j304qqrXaCekxhbJ2POK2zpfMr8PV2uLVOCFRJUAziWPa4CiS2d-kqWZz8ZSKqHKpxHV9HEUNEyeYoTVK989wc"
			}
		}
	}
}

Calling following mutation with access_token from previous response:

mutation {
	createJob(title: "title") {
		title
	}
}

but following error is returned

{
	"data": {
		"createJob": null
	},
	"errors": [
		{
			"message": "Class name must be a valid object or a string",
			"locations": [
				{
					"line": 2,
					"column": 2
				}
			]
		}
	]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.