ระบบ Affiliate Marketing แบบ Enterprise ที่ครบวงจรที่สุด
พัฒนาด้วย Laravel 11 + Vite | รองรับ 20+ ระบบหลัก | 389 Models | 294 Controllers | 433 Migrations
🌟 คุณสมบัติ • 📦 การติดตั้ง • 🏗️ สถาปัตยกรรม • 📖 เอกสาร • 💬 การสนับสนุน
- 🎯 Project Overview
- ✨ Core Features
- 🏗️ System Architecture
- 💻 Technology Stack
- 📦 Quick Installation
- 🔧 Configuration
- 🎨 Major Systems
- 🌐 API Documentation
- 📊 Database Structure
- 🔐 Security Features
- 🚀 Deployment
- 📖 Comprehensive Documentation
- 🛠️ Development Guide
- ❓ Troubleshooting
- 💬 Support & Community
- 📄 License
TP-Affiliate Pro เป็นระบบ Affiliate Marketing แบบ Enterprise-Level ที่พัฒนาด้วย Laravel 11 ครบวงจรที่สุดในตลาด ไม่ใช่แค่ระบบ Affiliate ธรรมดา แต่เป็น All-in-One Business Ecosystem ที่รวมระบบต่างๆ มากกว่า 20 ระบบหลัก เข้าด้วยกัน
-
💼 Enterprise Affiliate Marketing Platform
- ระบบ MLM (Multi-Level Marketing) แบบครบวงจร
- การจัดการคอมมิชชั่นหลายระดับ (Unilevel, Binary, Matrix)
- ระบบ Rank & Bonus อัตโนมัติ
- ติดตามยอดขายและคอมมิชชั่นแบบ Real-time
-
🛒 E-Commerce & Marketplace
- ระบบ Multivendor Marketplace สมบูรณ์
- การจัดการสินค้าและคำสั่งซื้อ
- ระบบ POS (Point of Sale)
- ระบบ Inventory Management
-
🤖 AI-Powered Automation
- LINE Official Account AI Bot
- Chatbot ขับเคลื่อนด้วย AI
- Auto-response และ Sentiment Analysis
- NLP (Natural Language Processing)
-
⛓️ Blockchain & Cryptocurrency
- TPIX Token System (ERC-20)
- Crypto Wallet Integration
- Staking & Farming
- NFT Marketplace
-
🏨 Industry-Specific Solutions
- Hotel Booking System
- Food Passport & Traceability
- Software Sales Platform
- Accounting System
| Metric | Count | Description |
|---|---|---|
| Models | 389 | Eloquent Models ครอบคลุมทุกฟีเจจอร์ |
| Controllers | 294 | Controllers แบ่งตาม Module |
| Migrations | 433+ | Database migrations พร้อม seeder |
| Routes | 1,000+ | Web, API, Admin, User routes |
| Services | 50+ | Business logic services |
| API Endpoints | 500+ | RESTful API endpoints |
| Documentation | 100+ MD files | เอกสารครบครัน |
| Lines of Code | 500,000+ | Production-ready code |
- ✅ Enterprise Companies - ต้องการระบบ Affiliate แบบครบวงจร
- ✅ MLM/Network Marketing - สร้างเครือข่ายการตลาดหลายระดับ
- ✅ E-Commerce Platforms - Marketplace พร้อม Affiliate System
- ✅ SaaS Providers - ขายซอฟต์แวร์พร้อมระบบ License
- ✅ Blockchain Projects - รวม Crypto/Token System
- ✅ AI/Chatbot Services - ระบบ LINE Bot และ AI
- ✅ System Integrators - นำไปต่อยอดและปรับแต่ง
-
🔥 ครบวงจรที่สุด
- รวม 20+ ระบบหลักในแพลตฟอร์มเดียว
- ไม่ต้องซื้อระบบต่างๆ แยก ประหยัดงบประมาณ
-
⚡ พร้อมใช้งานทันที
- ติดตั้งง่ายด้วย
install.shใช้เวลาไม่เกิน 10 นาที - มาพร้อม Demo Data และ Seeder สมบูรณ์
- ติดตั้งง่ายด้วย
-
🎨 UI/UX สุดทันสมัย
- ใช้ Tailwind CSS 3.4 + Alpine.js
- Dark/Light Mode ทุก Component
- Responsive Design (Mobile-first)
- Glassmorphism & 3D Effects
-
🔐 ความปลอดภัยระดับ Enterprise
- License System พร้อม IP Whitelist
- Two-Factor Authentication (2FA)
- Rate Limiting & CSRF Protection
- SQL Injection & XSS Prevention
-
🚀 Performance สูง
- Redis Caching
- Queue Jobs สำหรับ Heavy Tasks
- Database Optimization
- CDN Ready
-
📈 Scalable & Extensible
- Architecture แบบ Modular
- Easy to extend ด้วย Service Pattern
- API-First Design
- Microservices Ready
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
┌─────────────────────────────────────────────────────────────────────┐
│ TP-Affiliate Pro Ecosystem │
└─────────────────────────────────────────────────────────────────────┘
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Frontend Layer │────▶│ Backend Layer │────▶│ Data Layer │
│ │ │ │ │ │
│ • Blade Views │ │ • Laravel 11 │ │ • MySQL 8.0+ │
│ • Tailwind CSS │ │ • 389 Models │ │ • Redis Cache │
│ • Alpine.js │ │ • 294 Controllers│ │ • File Storage │
│ • Vite │ │ • 50+ Services │ │ • Queue Jobs │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌──────────────────────────────────────────────────────────────────────┐
│ Integration Layer │
├──────────────────────────────────────────────────────────────────────┤
│ • LINE Messaging API • Google Cloud APIs • Blockchain │
│ • Payment Gateways • Email Services • SMS Providers │
│ • Cloud Storage • CDN Services • Analytics │
└──────────────────────────────────────────────────────────────────────┘
Thaiprompt-Affiliate/
├── 📁 app/ # Laravel Application
│ ├── 📁 Console/ # 40+ Artisan Commands
│ │ └── Commands/
│ │ ├── License*.php # License management
│ │ ├── Update*.php # Version/update
│ │ ├── Crypto*.php # Blockchain
│ │ └── Data*.php # Data management
│ ├── 📁 Events/ # Event dispatching
│ ├── 📁 Exceptions/ # Error handlers
│ ├── 📁 Helpers/ # Helper functions
│ │ ├── SeoHelper.php
│ │ ├── IconHelper.php
│ │ └── CryptoHelper.php
│ ├── 📁 Http/
│ │ ├── 📁 Controllers/ # 294 Controllers
│ │ │ ├── 📁 Admin/ # 40+ Admin controllers
│ │ │ │ ├── AffiliateController.php
│ │ │ │ ├── CommissionController.php
│ │ │ │ ├── DashboardController.php
│ │ │ │ ├── ECommerceController.php
│ │ │ │ ├── RankController.php
│ │ │ │ ├── WalletController.php
│ │ │ │ ├── ArrowXThemeController.php
│ │ │ │ └── ... (35+ more)
│ │ │ ├── 📁 Api/V1/ # REST API controllers
│ │ │ │ ├── AuthController.php
│ │ │ │ ├── DashboardController.php
│ │ │ │ ├── TreeController.php
│ │ │ │ └── ... (20+ more)
│ │ │ ├── 📁 Auth/ # Authentication
│ │ │ ├── 📁 Frontend/ # Public pages
│ │ │ ├── 📁 Seller/ # E-commerce seller
│ │ │ └── 📁 User/ # User dashboard
│ │ ├── 📁 Middleware/ # 20+ Middleware
│ │ └── 📁 Requests/ # Form validation
│ ├── 📁 Jobs/ # Queue jobs
│ ├── 📁 Listeners/ # Event listeners
│ ├── 📁 Mail/ # Email notifications
│ ├── 📁 Models/ # 🔥 389 Eloquent Models
│ │ ├── User.php
│ │ ├── Affiliate.php
│ │ ├── Commission.php
│ │ ├── Rank.php
│ │ ├── Wallet.php
│ │ ├── WalletTransaction.php
│ │ ├── Product.php
│ │ ├── Order.php
│ │ ├── OrderItem.php
│ │ ├── AiBotProfile.php
│ │ ├── LineBotAiSetting.php
│ │ ├── TPIXStake.php
│ │ ├── CryptoWallet.php
│ │ ├── HotelBooking.php
│ │ ├── SoftwareQuotation.php
│ │ ├── TarotReading.php
│ │ └── ... (370+ more models)
│ ├── 📁 Notifications/ # Push/Email notifications
│ ├── 📁 Observers/ # Model observers
│ ├── 📁 Policies/ # Authorization policies
│ ├── 📁 Providers/ # Service providers
│ └── 📁 Services/ # 🔥 50+ Business Logic Services
│ ├── WalletService.php # (18,468 lines)
│ ├── RankingService.php # (10,028 lines)
│ ├── EmailService.php # (11,285 lines)
│ ├── NotificationService.php # (14,104 lines)
│ ├── LicenseService.php
│ ├── AICoreService.php
│ ├── BlockchainRecordService.php
│ ├── CacheManagementService.php
│ └── ... (42+ more services)
│
├── 📁 bootstrap/ # Framework bootstrap
├── 📁 config/ # 🔥 30+ Configuration files
│ ├── app.php
│ ├── database.php
│ ├── license.php # License system config
│ ├── version.php # Version management
│ ├── services.php # Third-party APIs
│ ├── payment.php # Payment gateways
│ └── ... (24+ more configs)
│
├── 📁 database/
│ ├── 📁 migrations/ # 🔥 433+ Migrations
│ │ ├── 2024_01_01_000000_create_users_table.php
│ │ ├── 2024_01_02_000000_create_affiliates_table.php
│ │ ├── 2024_01_03_000000_create_commissions_table.php
│ │ └── ... (430+ more migrations)
│ ├── 📁 seeders/ # Database seeders
│ │ ├── DatabaseSeeder.php
│ │ ├── UserSeeder.php
│ │ ├── RankSeeder.php
│ │ ├── ProductSeeder.php
│ │ └── ... (40+ seeders)
│ └── 📁 sql/ # Custom SQL scripts
│
├── 📁 lang/ # Multi-language files
│ ├── 📁 en/ # English
│ ├── 📁 th/ # Thai
│ └── 📁 [12 more languages]
│
├── 📁 public/ # Public assets
│ ├── 📁 build/ # Compiled Vite assets
│ ├── 📁 images/
│ ├── 📁 icons/
│ └── index.php
│
├── 📁 resources/
│ ├── 📁 css/ # Stylesheets
│ │ └── app.css # Tailwind CSS entry
│ ├── 📁 js/ # JavaScript modules
│ │ ├── app.js # Main JS entry
│ │ ├── bootstrap.js
│ │ ├── theme.js # Arrow X Theme
│ │ └── ... (20+ JS modules)
│ └── 📁 views/ # 🔥 100+ Blade templates
│ ├── 📁 admin/ # Admin dashboard UI
│ │ ├── dashboard.blade.php
│ │ ├── 📁 affiliates/
│ │ ├── 📁 ecommerce/
│ │ ├── 📁 ai-bots/
│ │ ├── 📁 commissions/
│ │ ├── 📁 wallet/
│ │ └── ... (40+ admin modules)
│ ├── 📁 auth/ # Login/Register
│ ├── 📁 frontend/ # Public pages
│ ├── 📁 user/ # User dashboard
│ ├── 📁 seller/ # Seller dashboard
│ ├── 📁 layouts/ # Master templates
│ │ ├── app.blade.php
│ │ ├── admin.blade.php # (77KB - feature-rich)
│ │ ├── seller.blade.php
│ │ └── user.blade.php
│ ├── 📁 components/ # Reusable components
│ └── 📁 emails/ # Email templates
│
├── 📁 routes/ # 🔥 Route definitions
│ ├── web.php # (44KB) Public web routes
│ ├── admin.php # (164KB) Admin routes
│ ├── api.php # (59KB) REST API routes
│ ├── user.php # (24KB) User dashboard
│ ├── seller.php # (10KB) Seller routes
│ ├── hotel-admin.php # (7KB) Hotel system
│ ├── software_sales.php # (7KB) Software sales
│ ├── bot_automation.php # (9KB) Bot automation
│ ├── pos.php # (2KB) Point of sale
│ └── console.php # Artisan commands
│
├── 📁 scripts/ # Utility scripts
│ ├── 📁 git-hooks/ # Git hooks
│ │ ├── install.sh
│ │ └── pre-commit
│ ├── deploy-to-distribution.sh
│ └── verify-seeders.php
│
├── 📁 storage/ # File storage
│ ├── 📁 app/
│ │ ├── 📁 public/ # Publicly accessible files
│ │ ├── 📁 backups/ # Database backups
│ │ └── installation_id.txt # Installation UUID
│ ├── 📁 framework/ # Framework cache
│ └── 📁 logs/ # Application logs
│
├── 📁 tests/ # PHPUnit tests
│ ├── 📁 Feature/
│ └── 📁 Unit/
│
├── 📁 tpix-blockchain/ # Blockchain smart contracts
│ ├── contracts/
│ ├── migrations/
│ └── test/
│
├── 📁 .claude/ # 🔥 Claude AI Guidelines
│ ├── instructions.md
│ ├── THAI_LANGUAGE_RULES.md
│ ├── DATABASE_GUIDELINES.md
│ ├── ROUTES_GUIDELINES.md
│ ├── V3_CODING_GUIDELINES.md # V3 Standards
│ ├── V3_UI_DESIGN_SYSTEM.md
│ └── V3_ALPINE_BEST_PRACTICES.md
│
├── 📁 .github/ # GitHub Actions
│ └── 📁 workflows/
│ ├── deploy-distribution.yml
│ └── tests.yml
│
├── 📁 mobile-app-samples/ # .NET MAUI mobile app
│
├── 📄 install.sh # 🚀 Installation script
├── 📄 deploy.sh # 🚀 Deployment script
├── 📄 fix-permissions.sh
├── 📄 rollback.sh
├── 📄 run-migrations.sh
│
├── 📄 .env.example # Environment template
├── 📄 composer.json # PHP dependencies
├── 📄 package.json # NPM dependencies
├── 📄 tailwind.config.js # Tailwind configuration
├── 📄 vite.config.js # Vite configuration
│
├── 📄 VERSION # Current version: 3.120.0
├── 📄 CHANGELOG.md # Version history
│
└── 📄 [100+ Documentation .md files] # 🔥 Comprehensive docs
├── README.md # This file
├── ARCHITECTURE.md # System architecture
├── CLAUDE_CONTEXT.md # AI context
├── INSTALLATION.md # Installation guide
├── API-DOCS.md # API documentation
├── DEVELOPMENT.md # Development guide
├── LINE_MEMBERSHIP_SIGNUP_README.md
├── TPIX_TOKEN_SYSTEM.md
├── MLM_SYSTEM_DOCUMENTATION.md
├── ARROW_X_README.md
├── DEMO_GAMES.md
└── ... (90+ more documentation files)
389 Models = 389+ Database Tables
users -- ผู้ใช้งานหลัก
user_profiles -- โปรไฟล์ผู้ใช้
user_settings -- การตั้งค่าผู้ใช้
user_documents -- เอกสารผู้ใช้
roles -- บทบาท (RBAC)
permissions -- สิทธิ์การใช้งาน
role_user -- ความสัมพันธ์ role-user
permission_role -- ความสัมพันธ์ permission-role
activity_logs -- บันทึกกิจกรรม
notifications -- การแจ้งเตือน
site_settings -- การตั้งค่าระบบaffiliates -- ข้อมูล affiliate
affiliate_links -- ลิงก์ affiliate
affiliate_clicks -- การคลิก
affiliate_conversions -- การแปลง (conversion)
commissions -- คอมมิชชั่น
commission_tiers -- ระดับคอมมิชชั่น
mlm_commissions -- คอมมิชชั่น MLM
mlm_settings -- การตั้งค่า MLM
mlm_pv_transactions -- PV (Point Value) transactions
ranks -- ยศ/แรงค์
rank_requirements -- เงื่อนไขการขึ้นแรงค์
rank_achievements -- ความสำเร็จแรงค์
user_rank_progress -- ความก้าวหน้าแรงค์wallets -- กระเป๋าเงิน
wallet_transactions -- ธุรกรรม
withdrawal_requests -- คำขอถอนเงิน
deposits -- การฝากเงิน
payment_methods -- ช่องทางชำระเงิน
payment_gateways -- Payment gateway settings
installment_plans -- แผนผ่อนชำระ
cashbacks -- คืนเงินproducts -- สินค้า
product_categories -- หมวดหมู่สินค้า
product_images -- รูปภาพสินค้า
product_variations -- ตัวเลือกสินค้า
orders -- คำสั่งซื้อ
order_items -- รายการในคำสั่งซื้อ
shopping_carts -- ตะกร้าสินค้า
wishlists -- รายการโปรด
reviews -- รีวิว
ratings -- คะแนน
coupons -- คูปอง
flash_sales -- ลดราคาพิเศษsellers -- ผู้ขาย
seller_profiles -- โปรไฟล์ผู้ขาย
seller_payouts -- การจ่ายเงินผู้ขาย
marketplace_commissions -- ค่าคอมมิชชั่น marketplace
marketplace_settings -- การตั้งค่า marketplace
marketplace_affiliate_links -- ลิงก์ affiliate marketplace
marketplace_sync_logs -- Sync logsline_bot_ai_settings -- การตั้งค่า LINE Bot
line_bot_messages -- ข้อความ
line_bot_responses -- คำตอบ
line_bot_keywords -- คำสำคัญ
line_broadcast_messages -- ข้อความ broadcast
line_rich_menus -- Rich menu
line_signup_sessions -- Session การสมัคร
line_signup_step_logs -- Log แต่ละขั้นตอน
ai_bot_profiles -- โปรไฟล์ AI Bot
ai_installations -- การติดตั้ง AI
ai_conversations -- บทสนทนา AI
ai_usage_logs -- Log การใช้งาน AI
message_sentiments -- การวิเคราะห์ความรู้สึก
message_similarities -- ความคล้ายคลึงข้อความ
conversation_contexts -- บริบทบทสนทนาcrypto_wallets -- กระเป๋าเงิน crypto
crypto_transactions -- ธุรกรรม crypto
crypto_exchange_transactions -- ธุรกรรมแลกเปลี่ยน
tpix_stakes -- TPIX Staking
staking_positions -- ตำแหน่ง staking
blockchain_records -- บันทึก blockchain
nfc_cards -- NFC Card system
trading_trades -- การเทรด
trading_orders -- คำสั่งซื้อขายhotels -- โรงแรม
hotel_rooms -- ห้องพัก
hotel_bookings -- การจอง
hotel_room_types -- ประเภทห้อง
hotel_amenities -- สิ่งอำนวยความสะดวกfood_products -- สินค้าอาหาร
food_certifications -- ใบรับรอง
food_traceability -- การติดตาม
carbon_footprint_records -- บันทึก carbon footprint
quality_controls -- การควบคุมคุณภาพsoftware_products -- ซอฟต์แวร์
software_licenses -- ลิขสิทธิ์
software_quotations -- ใบเสนอราคา
software_customers -- ลูกค้าaccounting_chart_of_accounts -- ผังบัญชี
accounting_journals -- สมุดรายวัน
accounting_ledgers -- บัญชีแยกประเภท
payroll_records -- เงินเดือน
attendance_records -- การเข้างานgame_settings -- การตั้งค่าเกม
game_scores -- คะแนนเกม
game_leaderboards -- ตารางผู้นำ
video_rewards -- รางวัลจากวิดีโอ
video_watch_sessions -- Session การดูวิดีโอ
video_quests -- ภารกิจวิดีโอ
tarot_readings -- การอ่านไพ่ทาโรต์
tarot_cards -- ไพ่ทาโรต์
tarot_spread_types -- ประเภทการจั่ว
tarot_user_limits -- โควต้าผู้ใช้pages -- หน้าเว็บ
page_builder_templates -- Template page builder
menus -- เมนู
menu_items -- รายการเมนู
sliders -- สไลเดอร์
smart_sliders -- Smart slider
theme_components -- Component ธีม
theme_settings -- การตั้งค่าธีมtickets -- ตั๋วซัพพอร์ต
ticket_replies -- คำตอบตั๋ว
kb_articles -- บทความฐานความรู้
kb_categories -- หมวดหมู่ฐานความรู้
faqs -- คำถามที่พบบ่อยanalytics_events -- เหตุการณ์
analytics_page_views -- การดูหน้า
cookie_consents -- ความยินยอม cookie
keyword_relationships -- ความสัมพันธ์คำสำคัญ
trend_analyses -- การวิเคราะห์เทรนด์translations -- การแปลภาษา
language_settings -- การตั้งค่าภาษา
email_templates -- แม่แบบอีเมล
sms_templates -- แม่แบบ SMS
otp_settings -- การตั้งค่า OTP
app_banners -- แบนเนอร์แอป
pos_transactions -- ธุรกรรม POS
pos_advertisements -- โฆษณา POS
quizzes -- แบบทดสอบ
quiz_questions -- คำถามแบบทดสอบ50+ Services จัดการ Business Logic แยกออกจาก Controller
// Service Pattern Example
app/Services/
├── WalletService.php // 💰 18,468 lines - Wallet management
│ ├── createWallet()
│ ├── deposit()
│ ├── withdraw()
│ ├── transfer()
│ └── getBalance()
│
├── RankingService.php // 🏆 10,028 lines - Rank calculation
│ ├── calculateRank()
│ ├── checkRequirements()
│ ├── upgradeRank()
│ ├── downgradeRank()
│ └── distributeBonus()
│
├── EmailService.php // 📧 11,285 lines - Email sending
│ ├── sendWelcome()
│ ├── sendCommission()
│ ├── sendWithdrawal()
│ └── sendNotification()
│
├── NotificationService.php // 🔔 14,104 lines - Notifications
│ ├── send()
│ ├── sendPush()
│ ├── sendEmail()
│ └── sendSMS()
│
├── LicenseService.php // 🔐 License validation
├── AICoreService.php // 🤖 AI processing
├── BlockchainRecordService.php // ⛓️ Blockchain integration
├── CacheManagementService.php // 🚀 Cache optimization
└── ... (42+ more services){
"framework": "Laravel 11.x",
"php": "8.1+",
"architecture": "MVC + Service Layer",
"patterns": [
"Repository Pattern",
"Service Pattern",
"Observer Pattern",
"Factory Pattern"
]
}{
"primary_db": "MySQL 8.0+ / MariaDB 10.3+",
"cache": "Redis",
"queue": "Redis / Database",
"search": "Full-text search",
"orm": "Eloquent ORM"
}{
"google/cloud-translate": "^1.15", // Multi-language
"google/cloud-vision": "^1.7", // OCR & Image recognition
"intervention/image": "^3.11", // Image processing
"web3p/web3.php": "^0.1.6", // Blockchain integration
"jenssegers/agent": "^2.6", // User agent detection
"guzzlehttp/guzzle": "^7.2", // HTTP client
"laravel/sanctum": "^4.0", // API authentication
"laravel/reverb": "*" // WebSocket server
}{
"build_tool": "Vite 5.0",
"css_framework": "Tailwind CSS 3.4",
"css_plugins": [
"@tailwindcss/forms ^0.5.7"
],
"preprocessor": "PostCSS 8.4"
}{
"primary": "Alpine.js 3.13.5", // Lightweight reactivity
"bundle_size": "~15KB gzipped",
"features": [
"x-data", "x-show", "x-if",
"x-for", "x-model", "x-bind"
]
}{
"charts": "Chart.js 4.4.1",
"3d_graphics": "Three.js 0.181.1",
"data_viz": "D3.js 7.9.0",
"network_viz": "vis-network 10.0.2",
"animation": "GSAP 3.12.5",
"drag_drop": "SortableJS 1.15+"
}{
"ethereum": "ethers 5.8.0",
"wagmi_core": "@wagmi/core 1.4.13",
"web3modal": "@web3modal/wagmi 3.5.7",
"viem": "viem 1.21.4"
}{
"http_client": "axios 1.6.4",
"websocket": "laravel-echo 2.2.6",
"realtime": "pusher-js 8.4.0",
"qr_code": "qrcode 1.5.4",
"barcode": "jsbarcode 3.12.1",
"pdf": "jspdf 3.0.3",
"screenshot": "html2canvas 1.4.1"
}-- Primary Database
MySQL 8.0+ or MariaDB 10.3+
-- Features Used:
- JSON columns
- Full-text search
- Stored procedures
- Triggers
- Views
- Foreign key constraints
- Indexes optimization
-- Database Size:
- 433+ migrations
- 389+ tables
- 1,000+ columns
- Complex relationships# Version Control
git: "Latest"
github_actions: "CI/CD pipelines"
# Code Quality
laravel_pint: "PHP CodeStyle"
phpunit: "^11.0"
phpstan: "Static analysis"
# Development
composer: "2.0+"
npm: "Latest"
node: "18+"
# Server Requirements
web_server: "Nginx / Apache"
php_fpm: "8.1+"
redis_server: "6.0+"
mysql_server: "8.0+"- ✅ PaySolutions (Thailand)
- ✅ PromptPay QR Code
- ✅ Stripe (International)
- ✅ Omise (Thailand)
- ✅ 2C2P
- ✅ Bank Transfer
- ✅ LINE Messaging API
- ✅ Twilio (SMS)
- ✅ SendGrid (Email)
- ✅ Mailgun (Email)
- ✅ Amazon SES
- ✅ Google Cloud Translate API
- ✅ Google Cloud Vision API
- ✅ AWS S3 (Storage)
- ✅ Cloudflare (CDN)
- ✅ Ethereum Network
- ✅ BSC (Binance Smart Chain)
- ✅ Infura (Node provider)
- ✅ MetaMask Integration
- ✅ Google Analytics
- ✅ Facebook Pixel
- ✅ Custom Analytics Engine
| Component | Minimum | Recommended |
|---|---|---|
| PHP | 8.1.0 | 8.2+ |
| MySQL | 5.7.0 | 8.0+ |
| MariaDB | 10.3.0 | 10.6+ |
| Redis | 5.0 | 7.0+ |
| Composer | 2.0 | 2.6+ |
| Node.js | 18.0 | 20+ |
| NPM | 9.0 | 10+ |
| Memory | 512 MB | 2 GB+ |
| Disk Space | 2 GB | 10 GB+ |
✓ pdo
✓ pdo_mysql
✓ mbstring
✓ openssl
✓ json
✓ curl
✓ gd
✓ xml
✓ zip
✓ bcmath
✓ tokenizer
✓ fileinfo
✓ redis (optional but recommended)
# 1. Clone repository
git clone https://github.com/xjanova/Thaiprompt-Affiliate.git
cd Thaiprompt-Affiliate
# 2. Run auto-installer
chmod +x install.sh
./install.sh
# The installer will:
# ✓ Check system requirements
# ✓ Install Composer dependencies
# ✓ Install NPM dependencies
# ✓ Create .env file
# ✓ Generate application key
# ✓ Create database
# ✓ Run migrations
# ✓ Seed demo data
# ✓ Create Super Admin account
# ✓ Build frontend assets
# ✓ Set up file permissions
# ✓ Configure cache
# 3. Access your installation
# Frontend: http://yourdomain.com
# Admin: http://yourdomain.com/admin# 1. Clone repository
git clone https://github.com/xjanova/Thaiprompt-Affiliate.git
cd Thaiprompt-Affiliate
# 2. Install Composer dependencies
composer install
# 3. Install NPM dependencies
npm install
# 4. Create environment file
cp .env.example .env
# 5. Generate application key
php artisan key:generate
# 6. Configure database in .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=thaiprompt_affiliate
DB_USERNAME=root
DB_PASSWORD=
# 7. Create database
mysql -u root -p
CREATE DATABASE thaiprompt_affiliate CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
EXIT;
# 8. Run migrations
php artisan migrate
# 9. Seed database (optional but recommended)
php artisan db:seed
# 10. Create storage symlink
php artisan storage:link
# 11. Build frontend assets
npm run build
# 12. Set permissions
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
# 13. Optimize application
php artisan optimize
# 14. Start development server (for testing)
php artisan servephp artisan make:admin
# Or manually via Tinker
php artisan tinker
>>> User::create([
'name' => 'Super Admin',
'email' => 'admin@yourdomain.com',
'password' => bcrypt('your-secure-password'),
'role' => 'super_admin'
]);Via Admin Panel:
- Login to
/admin - Go to Settings → General
- Configure:
- Site name
- Site logo
- Contact email
- Timezone
- Default language
Edit .env:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"# For development (simple)
php artisan queue:work
# For production (with Supervisor)
sudo nano /etc/supervisor/conf.d/thaiprompt-affiliate-worker.confSupervisor Configuration:
[program:thaiprompt-affiliate-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=4
redirect_stderr=true
stdout_logfile=/path/to/storage/logs/worker.log
stopwaitsecs=3600# Add to crontab
crontab -e
# Add this line
* * * * * cd /path/to/project && php artisan schedule:run >> /dev/null 2>&1server {
listen 80;
listen [::]:80;
server_name yourdomain.com;
root /var/www/thaiprompt-affiliate/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}# Install Certbot
sudo apt install certbot python3-certbot-nginx
# Get SSL certificate
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# Auto-renewal is configured automatically# ===================================
# Application
# ===================================
APP_NAME="TP-Affiliate Pro"
APP_ENV=production
APP_KEY=base64:...
APP_DEBUG=false
APP_URL=https://yourdomain.com
APP_VERSION=3.120.0
# ===================================
# Database
# ===================================
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=thaiprompt_affiliate
DB_USERNAME=root
DB_PASSWORD=
# ===================================
# Cache & Session
# ===================================
CACHE_DRIVER=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
# ===================================
# Queue
# ===================================
QUEUE_CONNECTION=redis
# ===================================
# Email
# ===================================
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"
# ===================================
# License System
# ===================================
LICENSE_KEY=
LICENSE_INSTALLATION_ID=
LICENSE_API_URL=https://xman4289.com/wp-json/tp-license/v1
LICENSE_DEVELOPER_MODE=false
LICENSE_ALLOW_OFFLINE=false
LICENSE_CACHE_DURATION=604800
# ===================================
# LINE Integration
# ===================================
LINE_CHANNEL_ID=
LINE_CHANNEL_SECRET=
LINE_ACCESS_TOKEN=
LINE_BOT_BASIC_ID=
LINE_LIFF_ID=
# ===================================
# Google Cloud APIs
# ===================================
GOOGLE_CLOUD_PROJECT_ID=
GOOGLE_CLOUD_TRANSLATE_API_KEY=
GOOGLE_CLOUD_VISION_API_KEY=
# ===================================
# Payment Gateways
# ===================================
# PaySolutions
PAYSOLUTIONS_MERCHANT_ID=
PAYSOLUTIONS_SECRET_KEY=
# PromptPay
PROMPTPAY_MERCHANT_ID=
PROMPTPAY_REFERENCE_PREFIX=
# Stripe
STRIPE_KEY=
STRIPE_SECRET=
STRIPE_WEBHOOK_SECRET=
# Omise
OMISE_PUBLIC_KEY=
OMISE_SECRET_KEY=
# ===================================
# Blockchain (TPIX)
# ===================================
TPIX_CONTRACT_ADDRESS=
TPIX_RPC_URL=
TPIX_CHAIN_ID=
TPIX_PRIVATE_KEY=
# ===================================
# SMS Provider
# ===================================
TWILIO_SID=
TWILIO_TOKEN=
TWILIO_FROM=
# ===================================
# Storage
# ===================================
FILESYSTEM_DISK=local
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
# ===================================
# Analytics
# ===================================
GOOGLE_ANALYTICS_ID=
FACEBOOK_PIXEL_ID=
# ===================================
# Social Login
# ===================================
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
FACEBOOK_REDIRECT_URL=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URL=return [
'api_url' => env('LICENSE_API_URL'),
'license_key' => env('LICENSE_KEY'),
'installation_id' => env('LICENSE_INSTALLATION_ID'),
'developer_mode' => env('LICENSE_DEVELOPER_MODE', false),
'allow_offline' => env('LICENSE_ALLOW_OFFLINE', false),
'cache_duration' => env('LICENSE_CACHE_DURATION', 604800), // 7 days
];return [
'current' => env('APP_VERSION', file_get_contents(base_path('VERSION'))),
'repository' => [
'owner' => 'xjanova',
'name' => 'TP-Affiliate',
'api_url' => 'https://api.github.com/repos/xjanova/TP-Affiliate',
],
'update_channel' => env('UPDATE_CHANNEL', 'stable'), // stable, beta
];return [
'line' => [
'channel_id' => env('LINE_CHANNEL_ID'),
'channel_secret' => env('LINE_CHANNEL_SECRET'),
'access_token' => env('LINE_ACCESS_TOKEN'),
],
'google_translate' => [
'api_key' => env('GOOGLE_CLOUD_TRANSLATE_API_KEY'),
],
'stripe' => [
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
// ... more services
];เอกสาร: MLM_SYSTEM_DOCUMENTATION.md
- ✅ Unilevel Plan - ไม่จำกัดความกว้าง
- ✅ Binary Plan - แบบ 2 ขา (Left/Right)
- ✅ Matrix Plan - จำกัดความกว้าง (3x7, 4x7, etc.)
- ✅ Hybrid Plan - ผสมหลายแบบ
1. Direct Referral Commission
- ค่าแนะนำโดยตรง (5-20%)
2. Level Commission
- Level 1: 10%
- Level 2: 8%
- Level 3: 6%
- Level 4-10: 4-2%
3. Matching Bonus
- จับคู่ยอดขายจาก 2 ขา
- 10% ของคอมรวม
4. Rank Achievement Bonus
- Bronze: 5,000 THB
- Silver: 20,000 THB
- Gold: 100,000 THB
- Diamond: 500,000 THB- ✅ Visual Tree (D3.js)
- ✅ Drag & Zoom
- ✅ Search Members
- ✅ Filter by Rank/Status
- ✅ Export Tree
เอกสาร:
User Message
↓
Webhook Handler
↓
Keyword Detection
↓
├─ Exact Match? → Keyword Response
├─ Similar Match? → Suggest Keywords
└─ No Match? → AI Response
↓
Response Formatter
↓
LINE API
↓
User Receives Message
Step 1: Welcome & Terms ✓
↓
Step 2: Phone Number & OTP ✓
↓
Step 3: Personal Info ✓
↓
Step 4: Address ✓
↓
Step 5: Bank Details ✓
↓
Step 6: Upline/Referrer ✓
↓
Step 7: Confirmation & Complete ✓
↓
Welcome Bonus + Email Confirmation
เอกสาร: TPIX_TOKEN_SYSTEM.md
// TPIX Token (ERC-20)
contract TPIXToken {
string public name = "ThaiPrompt Token";
string public symbol = "TPIX";
uint8 public decimals = 18;
uint256 public totalSupply = 1000000000 * 10**18; // 1 Billion
// Functions
function transfer(address to, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
// Staking
function stake(uint256 amount, uint256 duration) external;
function unstake(uint256 stakeId) external;
function claimReward(uint256 stakeId) external;
}| Pool | Duration | APY | Min Amount |
|---|---|---|---|
| Flexible | Anytime | 5% | 100 TPIX |
| 30 Days | 30 days | 15% | 500 TPIX |
| 90 Days | 90 days | 25% | 1,000 TPIX |
| 180 Days | 180 days | 40% | 5,000 TPIX |
| 365 Days | 365 days | 60% | 10,000 TPIX |
เอกสาร:
- ARROW_X_README.md (1,053 lines)
- ARROW_X_DEPLOYMENT.md
# Compile theme
php artisan arrowx:compile
# Clear cache
php artisan arrowx:clear
# Warmup cache
php artisan arrowx:warmup
# Benchmark
php artisan arrowx:benchmark
# Show info
php artisan arrowx:info1. Cards (6 variants)
2. Buttons (8 variants)
3. Badges (7 variants)
4. Alerts (4 variants)
5. Forms & Inputs
6. Selects & Checkboxes
7. Navigation & Breadcrumbs
8. Tables & Pagination
9. Modals & Overlays
10. Tooltips & Popovers
... (17 components total)
// Product Model
class Product extends Model {
// Relations
public function category() // BelongsTo
public function images() // HasMany
public function variations() // HasMany
public function reviews() // HasMany
public function seller() // BelongsTo
// Scopes
public function scopeActive()
public function scopeFeatured()
public function scopeOnSale()
// Attributes
public function getPriceAfterDiscountAttribute()
public function getAverageRatingAttribute()
}1. Cart → Checkout
2. Payment Selection
3. Payment Verification
4. Order Created
5. Seller Notified
6. Order Confirmed
7. Shipping
8. Delivered
9. Review (Optional)
10. Commission Paid
เอกสาร: API Documentation - Food Passport
Farm/Producer
↓ (QR Code)
Processing Plant
↓ (QR Code)
Quality Control
↓ (QR Code)
Distribution Center
↓ (QR Code)
Retail Store
↓ (QR Code)
Consumer
- ✅ QR Code Generation
- ✅ Blockchain Verification
- ✅ Certificate Upload
- ✅ Carbon Footprint Calculation
- ✅ Supply Chain Tracking
- ✅ Quality Audit Logs
1. Search (Dates, Rooms)
2. View Available Rooms
3. Select Room Type
4. Guest Information
5. Payment
6. Booking Confirmation
7. Email/SMS Notification
8. Check-in/Check-out
- ✅ Room Management
- ✅ Pricing Calendar
- ✅ Booking Management
- ✅ Housekeeping Schedule
- ✅ Reports & Analytics
Base URL: https://yourdomain.com/api/v1
Authentication: Bearer Token (Laravel Sanctum)
Response Format: JSON
{
"success": true,
"data": {},
"message": "Success message",
"meta": {
"pagination": {}
}
}POST /api/v1/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
Response:
{
"success": true,
"data": {
"user": {
"id": 1,
"name": "John Doe",
"email": "user@example.com"
},
"token": "1|abc123..."
}
}POST /api/v1/register
Content-Type: application/json
{
"name": "John Doe",
"email": "user@example.com",
"password": "password123",
"password_confirmation": "password123",
"referrer_code": "ABC123" // optional
}POST /api/v1/logout
Authorization: Bearer {token}GET /api/v1/user
Authorization: Bearer {token}PUT /api/v1/user
Authorization: Bearer {token}
{
"name": "John Doe",
"phone": "0812345678",
"address": "..."
}GET /api/v1/wallet/balance
Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"fiat_balance": 15000.50,
"tpix_balance": 5000.00,
"point_balance": 1200
}
}POST /api/v1/wallet/withdraw
Authorization: Bearer {token}
{
"amount": 1000,
"method": "bank_transfer",
"bank_account": "1234567890"
}GET /api/v1/wallet/transactions?page=1&per_page=20
Authorization: Bearer {token}GET /api/v1/ranks
Response:
{
"success": true,
"data": [
{
"id": 1,
"name": "Bronze",
"requirements": {
"personal_sales": 10000,
"team_sales": 50000,
"direct_referrals": 3
},
"benefits": {
"commission_rate": 0.10,
"bonus": 5000
}
}
]
}GET /api/v1/products?page=1&category=1&sort=price_ascGET /api/v1/products/{id}POST /api/v1/orders
Authorization: Bearer {token}
{
"items": [
{
"product_id": 1,
"quantity": 2,
"variation_id": 5
}
],
"payment_method": "stripe",
"shipping_address": {...}
}GET /api/v1/orders
Authorization: Bearer {token}POST /api/webhook/line
X-Line-Signature: {signature}
{
"events": [
{
"type": "message",
"message": {
"type": "text",
"text": "Hello"
},
"replyToken": "...",
"source": {
"userId": "..."
}
}
]
}GET /api/v1/crypto/tpix/balance
Authorization: Bearer {token}POST /api/v1/crypto/tpix/stake
Authorization: Bearer {token}
{
"amount": 1000,
"duration": 90
}📖 Full API Documentation: API-DOCS.md (500+ endpoints)
Total Tables: 389+
Total Columns: 5,000+
Total Relationships: 1,000+
Total Indexes: 800+
Database Size: ~500MB (with demo data)
-- User → Affiliate → Commission
users
├─ has one → affiliates
│ ├─ has many → affiliate_links
│ ├─ has many → affiliate_clicks
│ └─ has many → commissions
├─ has one → wallet
│ └─ has many → wallet_transactions
├─ has many → orders
│ └─ has many → order_items
└─ belongs to → ranks
└─ has many → rank_requirements
-- Product → Category → Review
products
├─ belongs to → product_categories
├─ has many → product_images
├─ has many → product_variations
├─ has many → reviews
└─ belongs to → sellers
└─ has many → seller_payouts
-- LINE Bot → Message → Response
line_bot_ai_settings
├─ has many → line_bot_keywords
│ └─ has many → line_bot_responses
├─ has many → line_broadcast_messages
└─ has many → ai_conversations
└─ has many → message_sentiments
-- TPIX → Stake → Reward
crypto_wallets
├─ has many → crypto_transactions
├─ has many → tpix_stakes
│ └─ has many → staking_rewards
└─ belongs to → users
-- Order → Payment → Commission → Payout
orders
├─ has many → order_items
├─ has one → payment
├─ triggers → commission_calculation
│ └─ creates → commissions
│ └─ adds to → wallets
└─ notifies → seller
└─ triggers → seller_payoutCREATE TABLE users (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
email_verified_at TIMESTAMP NULL,
password VARCHAR(255) NOT NULL,
phone VARCHAR(20) NULL,
avatar VARCHAR(255) NULL,
role ENUM('user', 'admin', 'super_admin', 'seller') DEFAULT 'user',
status ENUM('active', 'inactive', 'suspended', 'banned') DEFAULT 'active',
rank_id BIGINT UNSIGNED NULL,
referrer_id BIGINT UNSIGNED NULL,
referral_code VARCHAR(20) UNIQUE,
two_factor_enabled BOOLEAN DEFAULT FALSE,
last_login_at TIMESTAMP NULL,
last_login_ip VARCHAR(45) NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL,
FOREIGN KEY (rank_id) REFERENCES ranks(id),
FOREIGN KEY (referrer_id) REFERENCES users(id),
INDEX idx_email (email),
INDEX idx_referral_code (referral_code),
INDEX idx_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;CREATE TABLE commissions (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
user_id BIGINT UNSIGNED NOT NULL,
order_id BIGINT UNSIGNED NULL,
type ENUM('direct', 'level', 'matching', 'rank_bonus') NOT NULL,
level INT NULL,
amount DECIMAL(15, 2) NOT NULL,
rate DECIMAL(5, 4) NULL,
base_amount DECIMAL(15, 2) NULL,
status ENUM('pending', 'approved', 'paid', 'cancelled') DEFAULT 'pending',
paid_at TIMESTAMP NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (order_id) REFERENCES orders(id),
INDEX idx_user_status (user_id, status),
INDEX idx_type (type),
INDEX idx_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;CREATE TABLE wallets (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
user_id BIGINT UNSIGNED NOT NULL UNIQUE,
fiat_balance DECIMAL(15, 2) DEFAULT 0.00,
tpix_balance DECIMAL(20, 8) DEFAULT 0.00000000,
point_balance INT DEFAULT 0,
cashback_balance DECIMAL(15, 2) DEFAULT 0.00,
frozen_balance DECIMAL(15, 2) DEFAULT 0.00,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
INDEX idx_user_id (user_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;-- Optimized Indexes
CREATE INDEX idx_commissions_user_status ON commissions(user_id, status);
CREATE INDEX idx_orders_user_status ON orders(user_id, status);
CREATE INDEX idx_products_category_status ON products(category_id, status);
CREATE INDEX idx_wallet_transactions_wallet_type ON wallet_transactions(wallet_id, type);
-- Full-Text Search
CREATE FULLTEXT INDEX ft_products_search ON products(name, description);
CREATE FULLTEXT INDEX ft_articles_search ON kb_articles(title, content);
-- Composite Indexes
CREATE INDEX idx_user_referral ON users(referrer_id, status, created_at);
CREATE INDEX idx_commission_summary ON commissions(user_id, status, type, created_at);// Multi-Factor Authentication
- Email/Password
- LINE Login (OAuth)
- Two-Factor Authentication (2FA)
- OTP Verification (SMS/Email)
- Remember Me (Secure)
// Role-Based Access Control (RBAC)
Roles:
- super_admin (All permissions)
- admin (Most permissions)
- seller (E-commerce permissions)
- user (Basic permissions)
Permissions:
- 50+ granular permissions
- Dynamic permission checking
- Role inheritance// Laravel Built-in Security
✓ CSRF Protection (All forms)
✓ XSS Prevention (Blade escaping)
✓ SQL Injection Prevention (Query Builder/Eloquent)
✓ Mass Assignment Protection (fillable/guarded)
✓ Password Hashing (bcrypt)
✓ Encryption (AES-256-CBC)
// Custom Security
✓ Rate Limiting (Throttle middleware)
✓ IP Whitelisting/Blacklisting
✓ Failed Login Lockout
✓ Suspicious Activity Detection
✓ Auto-ban System
✓ Activity Logging
✓ File Upload Validation
✓ Request Signature Verification (Webhooks)
// Headers Security
✓ X-Frame-Options: SAMEORIGIN
✓ X-Content-Type-Options: nosniff
✓ X-XSS-Protection: 1; mode=block
✓ Strict-Transport-Security (HSTS)
✓ Content-Security-Policy (CSP)// License Validation Flow
1. Check developer mode (bypass if enabled)
2. Load license from .env
3. Check cache (7 days)
4. Validate with TpLicense API
- License key valid?
- Domain matches?
- IP whitelisted?
- Not expired?
5. Cache result
6. Allow/Deny access
// IP Whitelist System
- Admin manages IP whitelist in WordPress
- Installation checks IP before download
- Runtime validation checks IP
- IP change requires admin approval// Activity Logs
- User login/logout
- Profile changes
- Withdrawal requests
- Commission payments
- Admin actions
- API calls
- Failed attempts
// Log Retention
- 90 days for general logs
- 365 days for financial logs
- Permanent for audit trails./deploy.sh [branch]
# Features:
# ✓ Maintenance mode during deployment
# ✓ Automatic database backup
# ✓ Git pull latest code
# ✓ Composer install/update
# ✓ NPM build
# ✓ Database migrations
# ✓ Cache optimization
# ✓ Auto-retry on timeout (3 attempts)
# ✓ Rollback commands on failure
# ✓ Deployment logging
# Example:
./deploy.sh main./install.sh
# Interactive installer:
# 1. Check system requirements
# 2. Configure .env
# 3. Create database
# 4. Install dependencies
# 5. Run migrations
# 6. Seed data
# 7. Create admin account
# 8. Build assets
# 9. Set permissions
# 10. Complete setup./rollback.sh
# Rollback features:
# ✓ Restore previous git commit
# ✓ Restore database backup
# ✓ Restore file backup
# ✓ Clear caches
# ✓ Restart services# Check current version
php artisan app:version
# Output: Current version: 3.120.0
# Bump version
php artisan app:bump-version patch
php artisan app:bump-version minor
php artisan app:bump-version major
# Check for updates
php artisan app:check-update
# Auto-update (with license validation)
php artisan app:update# Before deployment
☐ Run tests: php artisan test
☐ Code formatting: ./vendor/bin/pint
☐ Build assets: npm run build
☐ Update CHANGELOG.md
☐ Bump VERSION
☐ Backup database
☐ Review .env settings
# Deployment
☐ Enable maintenance mode
☐ Pull latest code
☐ Install dependencies
☐ Run migrations
☐ Clear caches
☐ Optimize application
☐ Disable maintenance mode
# After deployment
☐ Test critical features
☐ Monitor error logs
☐ Check performance
☐ Verify backups
☐ Notify team// Caching Strategy
✓ Route caching: php artisan route:cache
✓ Config caching: php artisan config:cache
✓ View caching: php artisan view:cache
✓ Query result caching (Redis)
✓ Response caching (selected routes)
✓ CDN for static assets
// Database Optimization
✓ Query optimization
✓ Eager loading relationships
✓ Index optimization
✓ Database connection pooling
✓ Read replicas (optional)
// Frontend Optimization
✓ Asset minification (Vite)
✓ Image optimization (WebP)
✓ Lazy loading
✓ Code splitting
✓ Browser caching
✓ Gzip compression- ARCHITECTURE.md - Complete system architecture
- CLAUDE_CONTEXT.md - AI assistant guidelines
- INSTALLATION.md - Detailed installation guide
- DEVELOPMENT.md - Development guidelines
- CHANGELOG.md - Version history
- .claude/instructions.md - Core dev guidelines
- .claude/V3_CODING_GUIDELINES.md - V3 coding standards
- .claude/V3_UI_DESIGN_SYSTEM.md - UI/UX standards
- .claude/V3_ALPINE_BEST_PRACTICES.md - Alpine.js patterns
- .claude/THAI_LANGUAGE_RULES.md - Thai language requirements
- .claude/DATABASE_GUIDELINES.md - Database best practices
- .claude/ROUTES_GUIDELINES.md - Route conventions
- .claude/seeder-guidelines.md - Seeder synchronization
- LINE_BOT_AI_IMPLEMENTATION.md - LINE Bot implementation
- LINE_MEMBERSHIP_SIGNUP_README.md - Signup system (Technical)
- LINE_SIGNUP_SETUP_GUIDE.md - Setup guide
- LINE_SIGNUP_USAGE_GUIDE.md - Usage guide
- LINE_BOT_SETUP_GUIDE.md - Bot setup
- LINE_BOT_HYBRID_MODE.md - Hybrid bot architecture
- LINE_TEMPLATE_MANAGEMENT_GUIDE.md - Template management
- TPIX_TOKEN_SYSTEM.md - TPIX token documentation
- TPIX_STAKING_DEPLOYMENT.md - Staking deployment
- TPIX-MANAGEMENT-GUIDE.md - Management guide
- TRADING_BOT_SYSTEM_README.md - Trading bot
- TRADING_BOT_FEATURES.md - Trading features
- MLM_SYSTEM_DOCUMENTATION.md - Complete MLM guide
- MLM_IMPLEMENTATION_COMPLETE.md - Implementation details
- MLM_SETTINGS_SETUP.md - Settings configuration
- RANKING_SYSTEM.md - Rank system
- MULTIVENDOR_SETUP.md - Marketplace setup
- MULTIVENDOR_DESIGN.md - Marketplace design
- WALLET_SYSTEM.md - Wallet documentation
- ARROW_X_README.md - Arrow X complete guide (1,053 lines)
- ARROW_X_CHANGELOG.md - Changelog
- ARROW_X_SUMMARY.md - Executive summary
- ARROW_X_DEPLOYMENT.md - Deployment guide
- ARROW_X_MIGRATION.md - Migration guide
- PAGE_BUILDER_README.md - Page builder
- SMART_SLIDER_GUIDE.md - Smart slider
- DEMO_GAMES.md - Games documentation
- SNAKE_GAME_SETUP.md - Snake game
- SNAKE_GAME_API_DOCUMENTATION.md - Snake API
- TAROT_SYSTEM_README.md - Tarot system
- TAROT_3D_WEBGL_SYSTEM.md - 3D Tarot
- VIDEO_REWARD_SYSTEM_README.md - Video rewards
- SOFTWARE_SALES_SYSTEM.md - Software sales
- README-ACCOUNTING.md - Accounting system
- API Documentation (Food Passport in API-DOCS.md)
- API-DOCS.md - Complete API reference
- MULTI-LANGUAGE.md - Multi-language system
- NOTIFICATION_SYSTEM_V3.md - Notification system
- TICKET_SYSTEM_README.md - Support tickets
- NFC_CARD_SYSTEM_README.md - NFC cards
- OCR_SETUP_README.md - OCR system
- DEPLOYMENT.md - Deployment guide
- PRODUCTION-INSTALL.md - Production installation
- VERSIONING.md - Version management
- PERFORMANCE_OPTIMIZATION.md - Performance guide
- TROUBLESHOOTING_LOGO.md - Common issues
- SUPER-ADMIN.md - Super admin guide
- .claude/MENU_RULES.md - Menu system rules
- MENU_FIXES_SUMMARY.md - Menu fixes
# 1. Clone repository
git clone https://github.com/xjanova/Thaiprompt-Affiliate.git
cd Thaiprompt-Affiliate
# 2. Install Git Hooks (CRITICAL!)
bash scripts/git-hooks/install.sh
# 3. Install dependencies
composer install
npm install
# 4. Setup environment
cp .env.example .env
php artisan key:generate
# 5. Enable developer mode (skip license check)
# Add to .env:
LICENSE_DEVELOPER_MODE=true
# 6. Setup database
php artisan migrate
php artisan db:seed
# 7. Start development servers
php artisan serve &
npm run devเราอยู่ที่ Version 3 แล้ว - แนวทางการเขียนโค้ดเปลี่ยนแปลง
| ด้าน | V2 (เก่า) ❌ | V3 (ใหม่) ✅ |
|---|---|---|
| CSS Framework | Bootstrap + Custom CSS | Tailwind CSS (pure) |
| JavaScript | jQuery + Vue.js | Alpine.js (หลัก) |
| Drag & Drop | jQuery UI Sortable | SortableJS |
| UI Style | Flat, Traditional | 3D, Glassmorphism, Gradients |
❌ ห้ามใช้ jQuery สำหรับ DOM manipulation
❌ ห้ามใช้ Bootstrap classes
❌ ห้ามใช้ jQuery UI Sortable
❌ ห้ามสร้าง custom CSS classes ใหม่ (ยกเว้นจำเป็จริงๆ)
❌ ห้าม inline styles✅ ใช้ Tailwind CSS สำหรับทุก styling
✅ ใช้ Alpine.js สำหรับ interactivity
✅ Component-based architecture
✅ Modern UI - Glassmorphism, 3D effects
✅ Performance-first - Lazy loading, debounce
✅ Dark mode support ทุก component
✅ Mobile-first responsive# 1. Create feature branch
git checkout -b feature/your-feature-name
# 2. Make changes following V3 guidelines
# - Read .claude/V3_CODING_GUIDELINES.md
# - Use Thai language in comments
# - Implement dark/light mode
# - Make responsive design
# 3. Test locally
php artisan test
npm run build
# 4. Commit (Git hooks run automatically)
git add .
git commit -m "feat: your feature description"
# 5. Push to remote
git push -u origin feature/your-feature-name
# 6. Create pull request# Run all tests
php artisan test
# Run specific test file
php artisan test tests/Feature/WalletTest.php
# Run with coverage
php artisan test --coverage
# Run specific test method
php artisan test --filter test_user_can_withdrawComplete Checklist:
☐ Read relevant .claude/ guidelines
☐ Understand dark/light mode requirements
☐ Check existing similar features
# During Development
☐ Create migration with Schema::hasTable() check
☐ Create model with relationships
☐ Create seeder and add to DatabaseSeeder.php
☐ Create controller with validation
☐ Create routes with middleware
☐ Create views with dark/light mode
☐ Add Thai language comments
☐ Implement responsive design
☐ Add error handling
# After Development
☐ Run tests
☐ Build assets
☐ Test dark/light mode
☐ Test on mobile/tablet/desktop
☐ Commit with descriptive message
☐ Push to feature branch❌ Permission denied in storage/
# Fix permissions
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
# Or use script
./fix-permissions.sh❌ MySQL connection failed
- Check MySQL service:
sudo systemctl status mysql - Check credentials in
.env - Create database:
CREATE DATABASE thaiprompt_affiliate; - Grant privileges:
GRANT ALL ON thaiprompt_affiliate.* TO 'user'@'localhost';
❌ Deploy failed
# View deployment logs
tail -f storage/logs/deployment.log
# Rollback
./rollback.sh
# Or manual rollback
git reset --hard COMMIT_HASH
composer install
php artisan migrate:rollback
php artisan up❌ Assets not loading
# Rebuild assets
npm run build
# Clear cache
php artisan optimize:clear
# Check symlink
php artisan storage:link --force❌ Queue not processing
# Check queue worker
ps aux | grep "queue:work"
# Restart queue
php artisan queue:restart
# Monitor queue
php artisan queue:monitor❌ License validation failed
# Check license status
php artisan license:check
# Reactivate license
php artisan license:activate YOUR-LICENSE-KEY
# Check cache
php artisan cache:clear❌ Migration failed
# Check migration status
php artisan migrate:status
# Rollback last migration
php artisan migrate:rollback
# Fresh migration (CAUTION: deletes data)
php artisan migrate:fresh
# Fresh with seeders
php artisan migrate:fresh --seed- Check Documentation - 100+ MD files
- Search Issues - GitHub Issues
- Check Logs -
storage/logs/laravel.log - Debug Mode - Set
APP_DEBUG=true(development only) - Contact Support - support@thaiprompt.com
- GitHub Issues: Report Bug
- Email Support: support@thaiprompt.com
- Technical Support: dev@thaiprompt.com
- Website: https://thaiprompt.com
- 📖 Full Documentation: INSTALLATION.md
- 🐛 Issue Tracker: GitHub Issues
- 💡 Feature Requests: GitHub Discussions
- 🎓 Tutorial Videos: (Coming soon)
We welcome contributions! Please:
- Fork the repository
- Create feature branch
- Follow V3 coding standards
- Write tests
- Submit pull request
Contribution Guidelines: DEVELOPMENT.md
ThaiPrompt Development Team
- Professional Web Development
- Enterprise Solutions
- AI & Blockchain Integration
- Laravel 11 - PHP Framework
- MySQL - Database
- Redis - Cache & Queue
- Composer - Dependency Manager
- Tailwind CSS - CSS Framework
- Alpine.js - JavaScript Framework
- Vite - Build Tool
- Chart.js - Charts
- Three.js - 3D Graphics
- GSAP - Animation
- Google Cloud - Translation & Vision APIs
- LINE - Messaging Platform
- Stripe - Payment Gateway
- Infura - Blockchain Node
- Laravel Community
- Tailwind CSS Team
- Alpine.js Creator
- All Open Source Contributors
Copyright © 2025 ThaiPrompt Team. All rights reserved.
This project is commercial software licensed under a proprietary license.
- ✅ License System: WordPress-based license management
- ✅ IP Whitelist: Installation restricted by IP
- ✅ Domain Lock: Single domain per license
- ✅ Auto-updates: Receive updates with valid license
- ✅ Support: 1 year support included
// License checked on:
- Installation
- Every 24 hours (runtime)
- Before updates
- Before critical features
// Bypass for development:
LICENSE_DEVELOPER_MODE=true (in .env)For licensing inquiries: license@thaiprompt.com
Current Version: 3.120.0
Release Date: 2025-11-22
Build: Production
| Version | Date | Type | Highlights |
|---|---|---|---|
| 3.120.0 | 2025-11-22 | Major | AI Bot Profiles feature |
| 3.119.1 | 2025-11-22 | Patch | Menu fixes |
| 3.0.0 | 2025-11-15 | Major | V3 Release - Tailwind + Alpine.js |
| 2.203.0 | 2025-11-10 | Minor | Arrow X Theme System |
| 2.200.0 | 2025-11-01 | Minor | LINE Signup Enhancement |
| 1.144.0 | 2025-10-15 | Minor | TPIX Staking |
| 1.100.0 | 2025-09-01 | Minor | MLM System Complete |
| 1.0.0 | 2025-01-12 | Major | Initial Release |
# 🎯 Installation (Choose One Method)
# Method 1: Auto-installer (Recommended)
git clone https://github.com/xjanova/Thaiprompt-Affiliate.git
cd Thaiprompt-Affiliate
chmod +x install.sh
./install.sh
# Method 2: Manual
composer install && npm install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
npm run build
# 🌐 Access
# Frontend: http://yourdomain.com
# Admin: http://yourdomain.com/admin
# API: http://yourdomain.com/api/v1
# 🚀 Deploy Updates (Future)
./deploy.sh
# 📖 Documentation
# Read: INSTALLATION.md for detailed guide- Mobile Apps (.NET MAUI - iOS & Android)
- WhatsApp Bot Integration
- Telegram Bot Integration
- Voice Assistant (AI-powered)
- Advanced Analytics (ML-powered)
- Multi-currency Support (100+ fiat currencies)
- DeFi Integration (Yield farming, Liquidity pools)
- NFT Marketplace Expansion
- DAO Governance System
- GraphQL API (alongside REST)
Have ideas? Submit them:
If you find TP-Affiliate Pro useful, please give it a star on GitHub!
Made with ❤️ in Thailand
🏠 Website • 📖 Documentation • 🐛 Report Bug • 💬 Support
© 2025 ThaiPrompt Team. All Rights Reserved.