/laravue

Laravel 8 with Sail + Breeze + Sanctum, powered by Inertia + Vue + Tailwind

Primary LanguagePHP

Laravue

Deploy workflow badge

About Laravue

Laravue is a web application built with latest Laravel framework to date (v8) with Laravel Breeze package and Inertia JS, which powered by Vue JS 3 and Tailwind CSS. Other libraries are used as well, such as Select2 jQuery plugin, etc.

Disclaimer: there is no correlation with other Laravue project. This name was chosen arbitrarily when creating repo in Github.

For Sail users, the docker-compose.yml file has been customized to be used with Podman and Podman Compose. Just cd to clone directory of this repo, then run command:

podman-compose up

The change is just in the laravel.test service section:

        volumes:
        - '.:/var/www/html:z'

The bound volume need to be aded :z in order that Podman has read-write acces to host filesystem.

To access shell inside Podman, run this command:

podman exec -it laravue_laravel.test_1 /bin/bash

Sample deployment website is in here.

REST API Documentation

POST {{laravel_host}}/api/token/create

Querying for Sanctum API token for other endpoints authentication.

Request body sample (JSON):

{
	"email": "user1@example.com",
	"password": "user123"
}

Response sample (success):

{
  "token": "2|MNX1UJEqWKpbwmPpRiOFCamlgzIspfBwSTO7nXDC",
  "token_type": "Bearer"
}

GET {{laravel_host}}/api/rewards

Show user points and available rewards to redeem, as well as past redeemed rewards.

Needs token as Bearer auth value.

Response sample (success):

{
  "points": 1,
  "rewards": [],
  "redeems": [
    {
      "id": 5,
      "name": "Hadiah Kelima"
    }
  ]
}

POST {{laravel_host}}/api/redeem/:reward_id

Query redeem action to exchange points with available rewards.

Need token as Bearer auth value.

:reward_id (mandatory) is the ID of available reward to redeem.

Response sample (success):

{
  "status": "success",
  "reward": {
    "name": "Hadiah Kelima",
    "id": 5
  },
  "points": 0
}

"points" is the remaining user point after redeem action.

License

The Laravel framework is open-sourced software licensed under the MIT license.