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

Questions about using @eq and @paginate in same query for data search

Here is my DB tables: Here is my query : products( product_id: String! @eq orderBy: _ @orderBy(columns: ["created_at", "product_id"]) ): [Product!]! @paginate(defaultCount: 10) First question is : I need to pass it like…
0
votes
1 answer

How to get child object of the same Model on GraphQL with Lighthouse?

I have a Model call Task that can depend on another task. So we have a parent Task and a Child task, two objects with the same model. so I wrote the scheme: type Task { id: ID! content: JSON! task: Task @belongsTo(relation: "task") …
0
votes
1 answer

Laravel Lighthouse Nested Mutations Not Working

I'm using Laravel Lighthouse for creating a GraphQL APIs for my new app and now Nested Belongs to and Belongs to Many not working for create and update method, in the pivot table, nothing added and I get the following error: "SQLSTATE[HY000]:…
Mehdi Bahrami
  • 79
  • 1
  • 7
0
votes
1 answer

How does one define a polymorphic one-to-many relation for mutations in Laravel Lighthouse?

So I've been banging my head against the wall at this question and so far I've found no solution for this. I've created a fresh, cripsy Laravel project with the latest Lighthouse(4.12) and while I tried to follow the documentation on this I got…
TKrisee
  • 51
  • 2
  • 8
0
votes
2 answers

Lightouse PHP Graphql - How to create a relationship?

I'm struggling to understand how to create relationships through lighthouse. Let's say I have a Post model that belongsTo a User. In my schema.graphql, I have: type Mutation { createPost(input: CreatePostInput! @spread): Post! @create } input…
waffl
  • 5,179
  • 10
  • 73
  • 123
0
votes
0 answers

GraphQL ID type correction - how to use String?

I have a model with unique id's like d192a9be-c1f8-4099-8e88-7333ca07866d When queried using graphql the result is id: "0" so it looks like it's trying to convert to Int. How do I use String unique ID?
Elen
  • 95
  • 7
0
votes
1 answer

Lighthouse Nested Mutations FK Field not being filled

I'm having some issues wrapping my head around nested mutations with Lighthouse. I've got two models that are related: Ams\Account hasMany Ams\Contact. This is the Ams\Contact model: namespace App\Models\Ams; use Eloquent as Model; use…
rabrowne
  • 61
  • 6
0
votes
0 answers

GraphQL update multiple statusses

For my project I need to update the status for all posts where the status is currently 1. I've been trying to find a way to create a condition based mutation, or maybe even put multiple mutations in one request (though this has the disadvantage…
generator
  • 115
  • 1
  • 7
0
votes
1 answer

Laravel Lighthouse Problem with schema validation Undefined Scalar Mixed

I am trying to validate-schema but I am running into a very unfamiliar error. This happens when I try to run the PHP artisan lighthouse:validate-schema command. Prior to this, I have not encountered this problem at all. In fact, I just did an…
Richard Abear
  • 166
  • 1
  • 15
0
votes
1 answer

Cannot declare class, because the name is already in use

I'm trying to get data from my GraphQL but it returns this error: { "message": "Cannot declare class App\\GraphQL\\Mutations\\AcceptBooking, because the name is already in use", "exception":…
Steven van Eck
  • 305
  • 1
  • 3
  • 14
0
votes
1 answer

GraphQL with LARAVEL Lighthouse PHP - How to hide attributes?

The title says it all. If I have something like this: type Model { id name } and only specific users should be able to access the ID field. How I can do it? Same thing if specific users can access only Model > relationship data. How I can hide…
Cecily Miller
  • 370
  • 2
  • 22
0
votes
1 answer

Extend a lighthouse directive

I want to extend a directive @modelClass from the lighthouse library. I'm working on a modular architecture and I don't have an Eloquent Model, I have several, and I'm extending my first Model version, that's why I'm using an interface to bind the…
faiverson
  • 21
  • 3
0
votes
1 answer

How to test login with Dusk on a Laravel/Lighthouse/Passport/Nuxt App?

I've setup a Nuxt app with Laravel, and before doing too much I would like to setup Dusk testing. The app/login works great but I can't make it work on automated Dusk tests. It use lighthouse-graphql-passport-auth with the setup described here. I…
idFlood
  • 1,016
  • 10
  • 20
0
votes
1 answer

Lighthouse/GraphQL - Getting `null` for Polymorphic Relation in GraphQL Schema for Soft Deletes

I have a platform that enables users to download sound clips. Producers of the sound clips can see their history of downloads, but they can also delete files they don't want available for download anymore. Each download event has a DB record with a…
hcexile
  • 446
  • 7
  • 22
0
votes
1 answer

Lighthouse testing with postGraphQL fails when using subscriptions

I have a laravel package which uses GraphQL (Lighthouse) to extend my base project(s). Everything works fine when adding my package and doing queries etc. But since I try to make a postGraphQL request within my testing file, where the given query or…
carsten
  • 191
  • 1
  • 2
  • 7