php – Is there a way to get Laravel's authenticated user ID in Lighthouse?-ThrowExceptions

Exception or error:

I am developing a Web API with Laravel, and I want to use Lighthouse to move from REST to GraphQL.
Until now, the controller has read auth ()-> id and set it in the user_id column of the record to be added.
How can I set user_id to auth ()-> id in Lighthouse?

How to solve:

I solved myself. @inject directive
https://lighthouse-php.com/4.10/api-reference/directives.html#inject

Leave a Reply

Your email address will not be published. Required fields are marked *