A simple example of Laravel GraphQL using https://github.com/rebing/graphql-laravel
- Clone the repository with git clone
- Copy .env.example file to .env and edit database credentials there
- Run composer install
- Run php artisan migrate --seed
- If you have permission error run these commands https://gist.github.com/Daniyal-Javani/e7a6c70e2bae46945706cd345913c03d
/graphql?query={__schema{types{name,fields{name,description}}}}
or
{
__schema {
types {
name
fields {
name
description
}
}
}
}
/graphql?query=query+FetchUsers{users{id,email}}
or
query FetchUsers {
users {
id
email
}
}
/graphql?query=query+FetchUsers{users(id:"18"){id,email}}
or
query FetchUsers {
users (id: "18"){
id
email
}
}
/graphql?query=mutation+users{updateUserPassword(id:%221%22,password:%22newpassword%22){id,email}}
or
mutation users {
updateUserPassword(id: "1", password: "newpassword") {
id
email
}
}
/graphql?query=mutation+users{updateUserEmail(id:%221%22,email:%22newemail%22){id,email}}
or
mutation users {
updateUserEmail(id: "1", email: "newemail@example.com") {
id
email
}
}
Please use and re-use however you want.