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
2 answers

How can I register graphql for all modules separately like we register routes in Provider?

I have Laravel project with submodule I have to create graphql file in each module for a separate routes. How can I register graphql for all modules separately like we register routes in Provider? How to handle graphql file in multiple modules?
0
votes
2 answers

PHP - LightHouse - ID Scalar size not enough

I have a DB Table with a big int primary key. When my primary key is too large like 'xxxxxxxxxxxxxx' i get always this same value on lighthouse graphql query: 2147483647 Is there a way to declare the size of my ID? Like id:ID! BigInt
G_Dnsk
  • 21
  • 4
0
votes
2 answers

Laravel Lighthouse GraphQL create mutation without "input:"

I'm looking a the documentation for Laravel Lighthouse and I am seeing two types of mutations. A mutation that includes the string input: (found here) mutation { createPost(input: { # <-- the "input:" I'm talking about title: "My new Post" …
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
0
votes
1 answer

Php GraphQL implementation response is slower than REST

I'm experimenting graphql with php using lighthouse-php package. Fetching 8000 records from a table with RESTful implementation takes 1.7s to complete the request. Whereas with grapql implementation takes 4.99s to complete the request. Why graphql…
Ahmed
  • 71
  • 1
  • 8
0
votes
1 answer

Update trashed model

I'm trying to update a trashed model, without having to restore it first. Schema extend type Mutation { updateAuthor(id: ID!, input: AuthorInput @spread, trashed: Trashed @trashed): Author @update @softDeletes } Mutation mutation{ …
Gregory
  • 1,148
  • 1
  • 9
  • 24
0
votes
2 answers

Laravel Lighthouse: Using @paginate on related models breaks ability to query model directly

Suppose we have Series and Episodes, and each Series has many Episodes: type Query { series: [Series!]! @paginate(defaultCount: 10) series(id: ID @eq): Series @find episodes: [Episode!]! @paginate(defaultCount: 10) episode(id: ID @eq):…
clem
  • 123
  • 3
  • 10
0
votes
1 answer

Laravel Lighthouse GraphQL query data from a pivot table that connects three tables

In Laravel Lighthouse GraphQL, how can you retrieve the information from an intermediate "pivot" table? Suppose I have Users and Roles in a belongsToMany relation: type User { roles: [Role!]! @belongsToMany } type Role { users: [User!]!…
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
0
votes
0 answers

Laravel Lighthouse - Receive Eloquent Builder instead of Query Builder in handleBuilder method?

Is there a way to receive an instance of \Illuminate\Database\Eloquent\Builder instead of \Illuminate\Database\Query\Builder in the handleBuilder method when creating a custom ArgBuilderDirective? See this example:
0
votes
2 answers

Laravel Lighthouse GraphQL validation based on related model

Using Laravel Lighthouse GraphQL, i would like to validate a value in one model so that it always matches the value in a related model. In this case a Program has a year_id and a Category also has a year_id. I want to validate that the Program and…
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
0
votes
1 answer

Graphql Custom type-definition Laravel Lighthouse gives error about missing subClass

I copied the example that the Lighthouse website links to (https://webonyx.github.io/graphql-php/type-system/scalar-types/) for a custom Email type. (see code below) Unfortunately, if I now go to the graphql-playground, I get a 500 error…
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
0
votes
1 answer

Custom filters that accept objects - lighthouse-php

I am using lighthouse-php as Api Gateway in a micro services architecture. So for all my types I make a request internally through Guzzle. But I am needing to implement filters that are suitable for any type and that give flexibility when making…
0
votes
1 answer

Global middleware for Laravel Lighthouse

I would like to add something like this to all my queries and mutations type Query @middleware(checks: ["moduleCheck", "moduleScope"]){ // } Is there a way to run middleware globally? I can add it to the $middleware variable in Http\Kernal.php…
Edward Louth
  • 1,010
  • 2
  • 9
  • 19
0
votes
1 answer

Laravel Lighthouse, how can i get all array data when i do subscription?

I do subscription with laravel + Lighthouse + Laravel WebSockets + vue-apollo tech. When i subscription, i wanna get all array data, but i only got changed data. My schema.graphql is below. type Mutation { updateTest(id: ID!, name: String,…
Jeongkuk Seo
  • 127
  • 2
  • 15
0
votes
1 answer

SO composer require rebing/graphql-laravel fails

I have the following problem trying to install rebing/graphql-laravel via composer: $ composer require rebing/graphql-laravel Using version ^2.1 for rebing/graphql-laravel ./composer.json has been updated Loading composer repositories with package…
0
votes
2 answers

How should I setup the schema for deletion subscription?

I tried type Mutation { deleteUser(id: ID!): User @delete @broadcast(subscription: "userDeleted") } type Subscription { userDeleted(id: ID!): User } and I created a subcription where the methods authorize and filter return true. But I get…