# Web Based Voting System

## Features

### Admin Panel

- Login (API - Authentication / Passport)
- Start Election 
- View Election Result
- Stop Election
- View Election Final Result
- Position (CRUD)
- Partylist (CRUD)
- Voter (CRUD)
- Nominee (CRUD) (Also Contains Picture, Motto and Description)
- Update Account
- Manage Account - (Sub Admin Can't access this)
- Logout

### Voter Panel

- Login Using Their Unique Student ID
- Can See Candidate/Nominee Details
- Vote (Can only access when election started)
- Result (Can only access when she/he already vote)
- Logout


## Language Used

- PHP 5 (Note: This is not working on PHP v8 or higher)
- Laravel 5.4 (Php Framework)
- HTML
- CSS
- Javascript
- VueJS (Javascript Framework)
- MySQL

## Requirements

- PHP 5 or higher
- MySQL
- Composer (To install Laravel and Other Dependencies)
- NPM - To Compile Vue Components (optional)
- NodeJs - v14 to Compile Vue Components (optional)

## Setting UP

```shell
# First Clone the repository
git clone https://github.com/lenard123/Voting-System

# Navigate to the project directory
cd Voting-System

# Install PHP Dependencies using composer
composer install

# Copy .env.example to .env

# (Windows)
copy .env.example .env
# (On Linux)
cp .env.example .env

# Before you proceed to the next
# configure your database first
# in the .env file

# Generate Application key
php artisan key:generate

# Link storage
php artisan storage:link

# Run database migration
#   this command will automatically import
#   the database tables and default data
php artisan migrate:fresh --seed

# Install Passport keys
php artisan passport:install

# Finally, you can now serve the application
php artisan serve
# You can now view the system on http://localhost:8000
```

## Docker

This runs the app in **PHP 7.4** + **MySQL 8.0** without changing your Mac's PHP.

```shell
# Start containers (web at http://localhost:8080)
docker compose up -d --build

# Create .env if you haven't yet
cp .env.example .env

# Update these values in .env for Docker:
# DB_HOST=mysql
# DB_PORT=3306
# DB_DATABASE=voting
# DB_USERNAME=voting
# DB_PASSWORD=voting

# Install PHP dependencies
docker compose exec app composer install

# Generate app key
docker compose exec app php artisan key:generate

# Link storage (optional)
docker compose exec app php artisan storage:link

# Migrate + seed
docker compose exec app php artisan migrate:fresh --seed

# Passport keys (if you use Passport)
docker compose exec app php artisan passport:install
```

### Note

The Default user for admin is:
- email: lenard.mangayayam@voting-system.com
- password: admin

You can change it in .env file

### System Demo
You can watch the System Demo [here](https://youtu.be/dsEoONiovdA).

### Roulette Wheel URL: http://localhost:8080/demo/roulette
### Display Code URL: http://localhost:8080/display/kod-fizikal?k={{PHYSICAL_ATTENDANCE_GATE_DISPLAY_KEY}} 

### Role Code
- 1 = admin
- 2 = Jawatankuasa Audit
- 3 = Kaunter

```bash
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag=migrations
```