- Docker
- Docker Compose
- Git
- Laravel 11.x
- MySQL
---
title: Campaign Management Tool ERD
---
erDiagram
User ||--o{ Campaign : creates
Campaign ||--o{ Payout : has
User {
id integer PK
name varchar
email varchar
password varchar
remember_token varchar
email_verified_at timestamp
created_at timestamp
updated_at timestamp
}
Campaign {
id integer PK
user_id integer FK
title varchar
landing_page_url varchar
activity_status enum
created_at timestamp
updated_at timestamp
}
Payout {
id integer PK
campaign_id integer FK
country enum
payout_value decimal
created_at timestamp
updated_at timestamp
}
- Clone the repository then navigate to the project directory
cd campaign-tool-backend
- Create environment file
cp .env.example .env
- Start the application
docker compose up -d
- Install dependencies using Docker
docker compose exec laravel.test composer install
- Generate application key
docker compose exec laravel.test php artisan key:generate
- Run database migrations
docker compose exec laravel.test php artisan migrate
- Restart docker containers
docker compose restart
Now if you open the browser and navigate to http://localhost/api, you should see {"message":"Hello World"}
Project was setup using Laravel Sail After initial intall you can start using sail commands as well
./vendor/bin/sail up
./vendor/bin/sail down
./vendor/bin/sail logs -f
./vendor/bin/sail artisan <command>
./vendor/bin/sail composer <command>
./vendor/bin/sail artisan test
./vendor/bin/sail down --volumes --rmi all
You can add seed data by running the following command
./vendor/bin/sail artisan db:seed
- Application: http://localhost/api
- MySQL: Port 3306
- Redis: Port 6379
# Start application
docker compose up -d
# Stop application
docker compose down
# View logs
docker compose logs -f
# Run artisan commands
docker compose exec laravel.test php artisan <command>
# Run composer commands
docker compose exec laravel.test composer <command>
# Run tests
docker compose exec laravel.test php artisan test
# Clean all containers and volumes (useful for fresh start)
docker compose down --volumes --rmi all
The application code is mounted into the container, so any changes you make to your local files will be reflected immediately in the container.
Run tests using the following command:
docker compose exec laravel.test php artisan test
or
./vendor/bin/sail artisan test