Questions tagged [laravel-lighthouse]

Lighthouse is a PHP package that allows you to serve a GraphQL endpoint from your Laravel application.

Lighthouse is a PHP package that allows you to serve a GraphQL endpoint from your Laravel application. It greatly reduces the boilerplate required to create a schema, it integrates well with any Laravel project, and it's highly customizable giving you full control over your data.

276 questions
0
votes
1 answer

Laravel lighthouse graphql query by relation table value

Is it possible in Laravel lighthouse GraphQL to query by relation table values? For example, I have defined two types. type Translation { id: ID! form_group_id: Int! group: Group @hasOne translation_key: String! lv: String …
Ves
  • 7
  • 6
0
votes
1 answer

Implementing middleware before resolving and returning result

I want to check user auth before querying. Initially, I tried implementing a custom directive extending FieldMiddleware. But realized, this is checking the field of the in the returned model in this question here . Anyway, is there a way to check…
diggledoot
  • 691
  • 8
  • 22
0
votes
1 answer

laravel-lighthouse get unknown argument error when use @spread

im using laravel-lighthouse package. please look the method 2: when i use input and @spread for my login mutation i will get some errors that you can see below: but if i use method 1 it works without problem and return the token. why? (im using…
devmrh
  • 1,171
  • 4
  • 19
  • 46
0
votes
1 answer

How to add orderBy directive to relationship in a query?

I have this: type Client @guard { id: ID! name: String! phone: String orders: [Order!]! @hasMany # How do i make it possible to order this array via client side? } extend type Query { client ( id: ID! @eq ): Client @find } I would…
João Hamerski
  • 461
  • 1
  • 5
  • 22
0
votes
2 answers

Any idea how i can versioning my graphql API?

In rest API , we could version our APIS like this : example.com/api/v1/ And what is the idea when using a single GraphQL endpoint ? Thanks.
0
votes
1 answer

how to map a json in lighthouse graphql to convert it to graphql response

I do not know how to ask but I summarize what I want to do. I have a laravel server with lighthouse I do not handle databases or models, my data source is an api that returns the data in a json, now my query is how do I convert or map the json for a…
0
votes
1 answer

Lighthouse PHP - cannot view schema definition and docs in playground

for some reason I am not able to see the current schema definition/docs for the typedefs and resolvers I made on the playground itself. Some checks were the following: php artisan lighthouse:validate-schema - returns a handful of typos/errors and…
rhanmiano
  • 23
  • 3
0
votes
1 answer

Error in mutation nuwave/lighthouse:^5.0 and input

I am using nuwave/lighthouse:^5.0, and I am trying to create a mutation for an entity which have a belongsTo relationship. The thing is that in my input I am using a sanitizer directive to transform from string to id, but after that when Laravel…
0
votes
1 answer

How to query a third party package trait in Laravel lighthouse

I read Laravel Lighthouse documentation and searched around the web I did not find how to query a trait in a third party package in Laravel. I'm using the qirolab/laravel-reactions package, it has the reactionSummary() trait. I was asking how can I…
user2682025
  • 656
  • 2
  • 13
  • 39
0
votes
1 answer

Lighthouse graphql custom resolver

Quite new to GraphQL and lighthouse library, don't be too harsh. Since I can't use any models because my data source is an API. I'm trying to create a custom resolver that will pass data to a service who will do everything necessary to retrieve data…
Ves
  • 7
  • 6
0
votes
2 answers

How to assign an `user_id` to a newly created record in Laravel's Lighthouse?

Laravel's Lighthouse has directives to perform data-modifying CRUD operations directly on the database: @create, @delete, and @update. A simple CRUD's create can be implemented like this: type Mutation { createPost(title: String!): Post…
Daniel Loureiro
  • 4,595
  • 34
  • 48
0
votes
1 answer

Read a single sub-entry from the authenticated user

I'm using the "Viewer pattern" to fetch images that belong to the authenticated user: type Query { me: User! @auth } type User { name: String! images: [Image] @hasMany } And I fetch with: { me { images { id url } …
Daniel Loureiro
  • 4,595
  • 34
  • 48
0
votes
1 answer

update model in graphQL giving fields to update and array of id's

I have a problem. I want to create query to update some fileds on multiple model, it should looks like this: mutation{ updateInternalOrder( input: { state: { connect: 1 } id_internal_orders: [1,2] <= here …
burasuk
  • 162
  • 2
  • 8
0
votes
1 answer

Laravel lighthouse morphOne mutation

I want to allow users to upload images with their post but also have the ability to allow the users to upload images for the landingspage via a morphOne relation. I set up my models according to the laravel docs but can provide them if needed. than…
niels van hoof
  • 469
  • 4
  • 19
0
votes
0 answers

How to provide a eloquent relationship in object types with where condition in nuwave/lighthouse and laravel

I have the following problem. When doing a graphql query, i want to return a eloquent relationship with a where condition. As i'm also using this relationship in other parts of my api, i can't write a where condition directly in the relationship…
joh3rd
  • 5
  • 2