Skip to content

Commit a8bd92d

Browse files
committed
update Readme
1 parent 0232ffb commit a8bd92d

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

readme.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,80 @@ PASSPORT_CLIENT_SECRET=
2525

2626
You are done with the installation!
2727

28+
## Default Schema
29+
30+
By default the schema is defined internally in the package, if you want to override the schema or resolvers, you can publish the package configuration and default schema by running:
31+
32+
```
33+
php artisan vendor:publish --provider="Joselfonseca\LighthouseGraphQLPassport\Providers\LighthouseGraphQLPassportServiceProvider"
34+
```
35+
36+
This command will publish a configuration file `lighthouse-graphql-passport.php` and a schema file in `/graphql/auth.graphgl` that looks like this:
37+
38+
```js
39+
input LoginInput {
40+
username: String!
41+
password: String!
42+
}
43+
44+
input RefreshTokenInput {
45+
refresh_token: String
46+
}
47+
48+
type AuthPayload {
49+
access_token: String!
50+
refresh_token: String!
51+
expires_in: Int!
52+
token_type: String!
53+
}
54+
55+
type LogoutResponse {
56+
status: String!
57+
message: String
58+
}
59+
60+
type ForgotPasswordResponse {
61+
status: String!
62+
message: String
63+
}
64+
65+
input ForgotPasswordInput {
66+
email: String!
67+
}
68+
69+
input NewPasswordWithCodeInput {
70+
email: String!
71+
token: String!
72+
password: String!
73+
password_confirmation: String!
74+
}
75+
76+
extend type Mutation {
77+
login(data: LoginInput): AuthPayload! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\Login@resolve")
78+
refreshToken(data: RefreshTokenInput): AuthPayload! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\RefreshToken@resolve")
79+
logout: LogoutResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\Logout@resolve")
80+
forgotPassword(data: ForgotPasswordInput!): ForgotPasswordResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\ForgotPassword@resolve")
81+
updateForgottenPassword(data: NewPasswordWithCodeInput): ForgotPasswordResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\ResetPassword@resolve")
82+
}
83+
```
84+
85+
In the configuration file you can now set the schema file to be used for the exported one like this:
86+
87+
```php
88+
/*
89+
|--------------------------------------------------------------------------
90+
| GraphQL schema
91+
|--------------------------------------------------------------------------
92+
|
93+
| File path of the GraphQL schema to be used, defaults to null so it uses
94+
| the default location
95+
|
96+
*/
97+
'schema' => base_path('graphql/auth.graphql')
98+
```
99+
100+
This will allow you to change the schema and resolvers if needed.
101+
28102
## Usage
29103

30104
This will add 5 mutations to your GraphQL API

0 commit comments

Comments
 (0)