Download & Install Vagrant and Virtualbox
Install hostname plugin for Vagrant, run command vagrant plugin install vagrant-hostmanager
Run php vender/bin/homestead make
to generate your Homestead.yaml
You need an ssh keypair, Homestead defaults to "id_rsa", but you can configure a different pair in the project Homestead.yaml
. To generate a new key pair see this reference - https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key
Once everything is set up you can visit the project via http://homestead.test in the browser
Copy the env.example
to .env
Generate the app key - php artisan key:generate
Migrate the database - php artisan migrate
Install passport keys - php artisan passport:install
Seeder php artisan db:seed
Clear notifications php artisan notifications:clear
Importable Postman collection file included in repo api-example.postman_collection
[POST] /api/register
Request params: name
, email
, password
Response: {"token":"..."}
[POST] /api/login
Request params: email
, password
Response: {"token":"..."}
[GET] /api/user
Response:
{
"user": {
"id": 1,
"name": "User",
"email": "user@example.com",
"email_verified_at": null,
"created_at": "2020-07-23T12:51:03.000000Z",
"updated_at": "2020-07-23T12:51:03.000000Z"
}
}
[GET] /api/notifications
Response:
{
"success": true,
"data": [
{
"id": 1,
"user_id": 1,
"message": "Test notification",
"read": 0,
"created_at": "2020-07-23T14:14:12.000000Z",
"updated_at": "2020-07-23T14:14:12.000000Z"
}
]
}
[POST] /api/notifications
Request param: message
Response:
{
"success": true,
"data": {
"message": "Test notification",
"user_id": 1,
"updated_at": "2020-07-23T14:14:12.000000Z",
"created_at": "2020-07-23T14:14:12.000000Z",
"id": 1
}
}
[GET] /api/notifications/{id}
Response:
{
"success": true,
"data": {
"id": 1,
"user_id": 1,
"message": "Test notification",
"read": 0,
"created_at": "2020-07-23T14:14:12.000000Z",
"updated_at": "2020-07-23T14:14:12.000000Z"
}
}
[PUT] /api/notifications/{id}
Request param: read
(boolean)
Response:
{
"success": true
}
[DELETE] /api/notifications/{id}
Response:
{
"success": true
}