Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
861f909
[build]: clear cache
dawn-huang621 Jun 6, 2025
8211e43
[feat]:auto deploy
dawn-huang621 Jun 7, 2025
d0a38e9
[test]: test auto deploy
dawn-huang621 Jun 7, 2025
ec67c7f
[build]:github action ci file
dawn-huang621 Jun 7, 2025
87f85e2
[test]: ci run test
dawn-huang621 Jun 7, 2025
edf4726
[fix]:ci branch
dawn-huang621 Jun 7, 2025
d13adbf
[fix]:ci migrate fail
dawn-huang621 Jun 7, 2025
6302a50
[fix]:ci data service
dawn-huang621 Jun 9, 2025
2600692
[fix]:ci no .env
dawn-huang621 Jun 9, 2025
9229332
[test]:test auto deploy test 2
dawn-huang621 Jun 10, 2025
6a7d037
[test]:test auto deploy test 3
dawn-huang621 Jun 10, 2025
46becf9
[fix]:change cd branch
dawn-huang621 Jun 10, 2025
8de2b1b
[feat]:install beeze
dawn-huang621 Jun 13, 2025
0db59f9
Update Dockerfile for breeze v1
dawn-huang621 Jun 15, 2025
3b49708
Update Dockerfile for breeze v1.1
dawn-huang621 Jun 15, 2025
6dc3f7b
Update Dockerfile for breeze v1.2
dawn-huang621 Jun 15, 2025
9049bab
Update Dockerfile for breeze v1.3
dawn-huang621 Jun 15, 2025
f8b0a9b
[feat]:Add breeze and build assets
dawn-huang621 Jun 15, 2025
c391f1a
Merge branch 'master' of github.com:dawn-huang621/cicd-0602-fork
dawn-huang621 Jun 15, 2025
1a888ec
[feat]:product list
dawn-huang621 Jun 23, 2025
b3cfe01
[feat]:product create
dawn-huang621 Jul 3, 2025
d365b73
[feat]:訂單功能
dawn-huang621 Sep 6, 2025
c39c08f
[fix]:修理一些畫面路徑
dawn-huang621 Sep 9, 2025
8e188e2
[feat]:加上訂單狀態欄位
dawn-huang621 Sep 9, 2025
86163ba
[feat]:訂單審核,審核流水帳
dawn-huang621 Oct 1, 2025
296a2c7
[feat:報表功能,流水帳,圓餅圖
dawn-huang621 Jun 24, 2026
d6b8b40
[feat]:表格js前端渲染
dawn-huang621 Jun 24, 2026
3356f11
[build]:js引入
dawn-huang621 Jun 24, 2026
2099034
[build]:表格新增css,跟jquery
dawn-huang621 Jun 29, 2026
3df03d7
[fix]:修改訂單的表格,與刪除產品表的數量欄位
dawn-huang621 Jun 29, 2026
0edd73a
[feat];快速生成產品假資料
dawn-huang621 Jun 29, 2026
b3d7e71
[fix]:修改產品生成假資料改成更貼近現實產品
dawn-huang621 Jun 29, 2026
1528c95
[feat]:建立庫存首頁
dawn-huang621 Jun 29, 2026
3ed7562
[fix]:把breeze原本導向路徑修改正確
dawn-huang621 Jun 29, 2026
b92daca
[build]:新增整體架構,關係,使用技術講解
dawn-huang621 Jun 29, 2026
02e7ab4
[fix]:修改order worlFlow
dawn-huang621 Jun 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Laravel Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
laravel-tests:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_DB: laravel
POSTGRES_USER: laravel
POSTGRES_PASSWORD: secret
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5

env:
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_DATABASE: laravel
DB_USERNAME: laravel
DB_PASSWORD: secret

steps:
- uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist

- name: Copy .env
run: cp .env.example .env

- name: Generate key
run: php artisan key:generate

- name: Run migrations
run: php artisan migrate --force

- name: Run tests
run: ./vendor/bin/phpunit
16 changes: 16 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Deploy to Render

on:
push:
branches:
- master # 或你設定的部署分支

jobs:
deploy:
name: Trigger Render Deploy Hook
runs-on: ubuntu-latest

steps:
- name: Call Render deploy webhook
run: |
curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
13 changes: 13 additions & 0 deletions .github/workflows/flow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
┌────────────┐
│ Push │
│ to Git │
└────┬───────┘
┌──────────▼──────────┐
│ GitHub │
│ 自動觸發兩件事: │
│ │
│ 1. CI: ci.yml 執行 │─→ 測試 Laravel + DB
│ │
│ 2. CD: deploy.yml │─→ curl Deploy Hook URL → Render 開始部署
└─────────────────────┘
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ FROM richarvey/nginx-php-fpm:3.1.6

COPY . .

# 安裝 Node.js + npm(for Alpine)
RUN apk add --no-cache nodejs npm

# Image config
ENV SKIP_COMPOSER 1
ENV WEBROOT /var/www/html/public
Expand Down
171 changes: 158 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,167 @@
# Laravel 11 with a Docker PHP Image
# Mini ERP System

A demo repo for deploying a Laravel PHP application on [Render](https://render.com) using Docker. You can follow the getting started tutorial [here](https://render.com/docs/deploy-php-laravel-docker).
A lightweight ERP system for Sales and Inventory Management.

Built with Laravel 11, PostgreSQL, and Docker.

## Deployment
## Tech Stack

1. [Create](https://dashboard.render.com/new/database) a new PostgreSQL database on Render and copy the internal DB URL to use below.
* Laravel 11
* PostgreSQL
* Docker Compose
* Bootstrap 5
* Chart.js

2. Fork this repo to your own GitHub account.
---

3. Create a new **Web Service** on Render, and give Render's GitHub app permission to access your new repo.
## Dashboard

4. Select `Docker` for the environment, and add the following environment variable under the *Advanced* section:
> Dashboard Screenshot Here

| Key | Value |
| --------------- | --------------- |
| `APP_KEY` | Copy the output of `php artisan key:generate --show` |
| `DATABASE_URL` | The **internal database url** for the database you created above. |
| `DB_CONNECTION` | `pgsql` |
![Dashboard](docs/images/dashboard.png)

That's it! Your Laravel 11 app will be live on your Render URL as soon as the build finishes. You can test it out by registering and logging in.
---

## Order Workflow

```mermaid
flowchart TD

A["Create Order"]
--> B["Pending Approval"]

B --> C["Approved"]

C --> D["Ship Order"]

D --> E["Reduce Inventory"]

E --> F["Create Stock Movement"]
```

---

## Sample Sales Order

| Field | Value |
| --------- | --------- |
| Order No. | SO0001 |
| Customer | Company A |
| Status | Approved |
| Total | 60,000 |

### Order Items

| Product | Qty | Unit Price | Subtotal |
| ------- | --- | ---------- | -------- |
| Laptop | 2 | 30,000 | 60,000 |

---

## Stock Movement Example

| Date | Product | Type | Qty | Balance | Reference |
| ---------- | ------- | ---- | --- | ------- | --------- |
| 2026-06-24 | Laptop | OUT | -2 | 18 | SO0001 |

---

## Modules

### Sales Order Module

* Create sales orders
* Order approval workflow
* Order status management

### Inventory Module

* Inventory tracking
* Automatic stock deduction
* Stock movement history

### Dashboard Module

* Revenue statistics
* Order statistics
* Inventory overview

---

## Database ER Diagram

> ER Diagram Screenshot Here

![ERD](docs/images/erd.png)

---

## System Architecture

```text
Browser
Laravel Application
├── Controllers
├── Services
├── Models
└── Repositories
PostgreSQL
```

### Docker Environment

```text
Docker
├── nginx
├── php-fpm
└── postgres
```

---

## Technical Highlights

* Transaction handling for inventory consistency
* Service Layer architecture
* Approval workflow implementation
* Dockerized development environment
* Dashboard analytics with Chart.js

---

## Installation

```bash
git clone https://github.com/your-account/mini-erp.git

cd mini-erp

cp .env.example .env

docker compose up -d

docker compose exec app composer install

docker compose exec app php artisan key:generate

docker compose exec app php artisan migrate --seed
```

---

## Project Goals

This project simulates a lightweight ERP system focusing on sales and inventory workflows.

Key business scenarios include:

* Sales order management
* Approval workflow
* Inventory deduction
* Stock movement tracking
* Dashboard reporting
47 changes: 47 additions & 0 deletions app/Http/Controllers/Auth/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;

class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*/
public function create(): View
{
return view('auth.login');
}

/**
* Handle an incoming authentication request.
*/
public function store(LoginRequest $request): RedirectResponse
{
$request->authenticate();

$request->session()->regenerate();

return redirect()->intended(route('product.list', absolute: false));
}

/**
* Destroy an authenticated session.
*/
public function destroy(Request $request): RedirectResponse
{
Auth::guard('web')->logout();

$request->session()->invalidate();

$request->session()->regenerateToken();

return redirect('/');
}
}
40 changes: 40 additions & 0 deletions app/Http/Controllers/Auth/ConfirmablePasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;

class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*/
public function show(): View
{
return view('auth.confirm-password');
}

/**
* Confirm the user's password.
*/
public function store(Request $request): RedirectResponse
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}

$request->session()->put('auth.password_confirmed_at', time());

return redirect()->intended(route('product.list', absolute: false));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*/
public function store(Request $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false));
}

$request->user()->sendEmailVerificationNotification();

return back()->with('status', 'verification-link-sent');
}
}
Loading