'How to use Middleware in Graphql with laravel?

I am working on laravel application with graphql queries. in schema file some queries and mutations are there. the queries are like apis.

type Query {
    users: [User!]! @all @orderBy(column: "created_at",direction: DESC)
    user(id: ID @eq): User @find
}

here i have these two queries but i don't know how to create middleware for this query. if we create a separate query file for this and we call them means we are using laravel code in the query file but there also we are calling from schema file.

So i wanted to know any possibilities of setting middleware for the queries in graphql. like group middleware.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source