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
7
votes
1 answer

Laravel Lighthouse GraphQL - Sorting on server side

Hi I am new to GraphQL and I am trying to sort my data based on column content. I have an query endpoint where I can send: query { user(count:20, firstName:"Foo") { data { name region birthDate } } } And the result is…
TheKeymaster
  • 857
  • 1
  • 11
  • 27
6
votes
2 answers

Laravel Lighthouse Config - unable to locate publishable resources

I have installed the latest version of Lighthouse into my Laravel 7 app and it's been working fine with the out-of-the-box config. I now want to tweak some settings for better security, so as per the docs I have tried to use the following…
ElendilTheTall
  • 1,344
  • 15
  • 23
5
votes
0 answers

Laravel GraphQl getting Could not connect to websocket endpoint error

After implementing a simple GraphQl query such as a simple Mutation and Subscription I get this error when I try to run this subscription into graphql-playground: subscription { userCreated{ name username password } } I get…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
5
votes
1 answer

Experiencing intermittent errors when trying to use laravel lighthouse-php with Roadrunner Server

Roadrunner 1.8.1 Laravel: 7.17.2 Lighthouse: 4.15.0 When using NGINX, I have no issues with my GraphQL API/Schema. However, when I switch to Roadrunner, I suddenly, intermittently get errors like: "message": "Lighthouse failed while trying to load…
jake downs
  • 331
  • 3
  • 9
5
votes
1 answer

Declare variable in lighthouse graphql files

I've created a graphql file like this: type Field { id: ID! name_en: String! name_fa: String! description: String! img_url: String! created_at: DateTime! updated_at: DateTime! subFields: [SubField] @hasMany } extend…
Alireza A2F
  • 519
  • 4
  • 26
5
votes
4 answers

In Router.php line 366: Argument 1 passed to Illuminate\Routing\Router::group() must be of the type array,

I have update Laravel from v5.7 to v5.8 and now my application doesn't run. I updated it because of this issue: composer require rebing/graphql-laravel fails I solved the packages incompatibility but now Laravel crashes: $ php artisan serve In…
4
votes
3 answers

How to cache auth()->user() with relationship like role in Laravel cache to reduce calls to DB?

I am building an application that is using lighthouse-php. Because I have constantly set various policies for different users, I constantly query for user model with a role relationship in different parts applications, and for this reason, would…
Andrius Solopovas
  • 967
  • 11
  • 41
4
votes
1 answer

Laravel Lighthouse GraphQL unit tests: "Variable not defined"

I know my question title might not be the most informative, so please let me know if I can improve it somehow :). I'm trying to figure out how to pass GraphQL variables in a PHP unit test without writing them inline in the query. Here is a demo…
4
votes
1 answer

CORS Error in Laravel 7 using Laravel Lighthouse

I have an API built with Laravel and Lighthouse-php(for GraphQL). My client is built with Vue js and uses Apollo for the graphQL client-side implementation. Anytime I make a request, I get the following error: Access to fetch at…
crazy_abdul
  • 503
  • 6
  • 12
4
votes
2 answers

Laravel Lighthouse - Sorting a query by a property of a relationship

With a schema like the below, is there a way to execute a query and have the results sorted by the name property of the JobType entity? I'd like to have a paginated list of jobs, and display the results sorted by the job type name,…
Nathan Gaskin
  • 1,334
  • 9
  • 32
3
votes
0 answers

Multiple Unique Columns with a Lighthouse Validator Class

Goal: Output a custom validation message when attempting to insert a duplicate database record via GraphQL mutation using Laravel Lighthouse. I've got a unique key constraint being enforced on these multiple fields at the database layer via Laravel…
user110857
  • 2,023
  • 1
  • 21
  • 33
3
votes
1 answer

Lighthouse GraphQL - how to pass array as variable?

I'm working to build a simple Facebook clone to build up my knowledge of GraphQL. I'm using lighthouse-php on top of Laravel to serve my data. Essentially, a user has many friends, and I know this works because in the tinker console I can return the…
J. Jackson
  • 3,326
  • 8
  • 34
  • 74
3
votes
1 answer

How to get custom directive arguments in lighthouse graphql laravel

My question is regarding the custom directives https://lighthouse-php.com/4.11/the-basics/directives.html#definition My schema is: type Query { sayFriendly: String @append(text: ", please.") } in lighthouse.php the config, I already have…
Brian Amar
  • 41
  • 1
  • 4
3
votes
1 answer

Laravel Lighthouse Graphql HasOne nested relation not working

I am trying to get a HasOne relation to work in Laravel Lighthouse GraphQL. It doesn't work. The mutation does not give an error, but also doesn't update the relation (the employee id stays the same, while I want it to change to 2): mutation { …
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
3
votes
2 answers

Implementing Search funtionality in Laravel/Lighthouse GraphQL API

I'm creating a GraphQL implementation of an existing API. I'm using Laravel 5.8 with Lighthouse 3.7. I'm wondering how to implement a search functionality using this - something along the lines of... scheme.graphql type Query { userSearch(name:…
Binny V A
  • 2,036
  • 3
  • 20
  • 23
1
2 3
18 19