Skip to content

killerboduk1/Laravel-PhonebookAPI

Repository files navigation

Laravel Phonebook API

Installation

 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

Sample Graphql Query and Mutation

  • 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

Alt text

  • 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
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published