- clone the repo https://github.com/killerboduk1/Laravel-PhonebookAPI
- cd to Laravel-PhonebookAPI
- rename or copy .env.example to .env then update your Database credentials
- runs these commands
composer install
php artisan migrate
php artisan db:seed
- run these to generate the key
php artisan key:generate
php artisan optimize
php artisan config:cache
- run the project
php artisan serve
- First we need to use this to get the authorization token to be used to access other endpoint. I added the " graphql-playground " package so that we can test the graphql API replace the email with your Users data
mutation {
login(email:"[email protected]",password:"password", device:"web")
}
- After running the command above Copy the generated token and add the token to the HTTP HEADERS it should look like this
- View Contact with id filter
{
viewContact(id:4){
name
}
}
- List all Contact with pagination by 5
{
listContacts(first:5, page:1){
data{
name,
contact_no
}
}
}
- Create Contact
mutation {
createContact(name:"john doe 002", contact_no: "002-002-002"){
name
}
}
- Update Contact filter by ID
mutation {
updateContact(id:11, name:"john doe 2"){
name
}
}
- Delete Contact by ID
mutation {
deleteContact(id:11){
name
}
}