This is an API implementation for managing salesmen, based on the OpenAPI specification provided. The API is built using Laravel and offers various endpoints for CRUD operations on salesmen and codelists.
The live version of the app is available at https://holy-pine-3698.fly.dev.
- PHP 8.2
- Composer
- Docker (for Laravel Sail)
- Clone the repository
- Run
composer install
- Copy
.env.example
to.env
and update the environment variables - Run
php artisan key:generate
- Run
php artisan migrate:fresh --seed
to create and seed the database tables
This project is configured to use Laravel Sail, which provides a Docker environment for Laravel. To start the Sail environment, run:
./vendor/bin/sail up
GET /salesmen
: List all salesmenPOST /salesmen
: Create a new salesmanGET /salesmen/{salesman_uuid}
: Retrieve a specific salesmanPUT /salesmen/{salesman_uuid}
: Update a specific salesmanDELETE /salesmen/{salesman_uuid}
: Delete a specific salesman
GET /codelists
: Retrieve codelists for marital statuses, genders, and titles.
This API uses Laravel Sanctum for authentication. Tokens are used as bearer tokens for API requests.
For demonstration purposes, a token for the first user can be generated and retrieved at the GET /token
endpoint.
To make an authenticated request, include the following header:
Authorization: Bearer YOUR_TOKEN_HERE
The project includes a CSV seeder for salesmen. The CSV file is located at storage/database/seeders/salesmen.csv
. To seed the database, run:
php artisan db:seed