Giter Club home page Giter Club logo

laravel-shop's Introduction

簡易電商系統

這是一個使用 Laravel 建立的簡易電商系統。

測試報告

API 文件

環境要求

  • PHP >= 8.2
  • Composer
  • MySQL
  • Nginx
  • Docker
  • Docker Compose

安裝步驟

git clone https://github.com/zeqas/Laravel-shop.git  && cd ./Laravel-shop # 複製到本機
cp .env.example .env # 建立 .env 檔

設定資料庫相關參數

    DB_CONNECTION=mysql
    DB_HOST=db
    DB_PORT=3306
    DB_DATABASE=docker
    DB_USERNAME=root
    DB_PASSWORD=1Qaz2Wsx

使用 docker-compose 建立環境

使用前請確認 ports 的號碼是否已經被使用

docker-compose up --build -d # 建立容器
docker exec -it app bash # 進入 app 容器
php artisan key:generate # 生成 APP_KEY
php artisan migrate # 資料庫遷移

基本使用

目前有基礎首頁 但是在未登入的情況下,只能瀏覽,嘗試新增商品時會回應 401 Unauthorized 錯誤

建議透過 Postman 使用相關 API 除了 Controller 的註解之外,可以使用 scribe 生成文件

php artisan scribe:generate # 透過 scribe 生成文件

到 [URL]/docs (例如:http://0.0.0.0:8000/docs)查看相關文件

種子資料

可以先執行種子資料,生成各 10 筆的商品與使用者

php artisan db:seed

已完成功能

  • 商品列表:顯示所有商品的名稱和價格。

  • 商品搜尋:根據名稱和價格區間搜尋商品。

  • 新增商品:添加新的商品到系統中。

  • 編輯商品:修改現有商品的名稱和價格。

  • 刪除商品:從系統中移除商品。

  • 用戶註冊與登錄

  • 購物車功能

  • 簡易結算流程

  • 管理員後台(商品管理、訂單管理)

主要技術展示

  • Laravel

    • API 功能
    • CRUD
    • API validation
    • 身份驗證 (middleware)
    • Migration
    • Seeder
    • 資料 Model 之間的 relation
    • API 分層 (Controller, Service)
  • docker-compose.yml [MySQL + PHP + Nginx]

  • API Test (PHPUnit)

  • API Doc (Scribe)

  • CI Github Action (跑測試 + 產生 API 文件傳到 Github page)

  • MySQL

授權

此項目使用 MIT 授權。請查看 LICENSE 檔案以獲取更多資訊。

laravel-shop's People

Contributors

zeqas avatar

Watchers

 avatar

Forkers

kino9719

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.