MarketPro Docs
Complete technical reference for installing, configuring, and extending MarketPro β the multi-vendor e-commerce platform built on Laravel 12 with 13 AI features.
π Overview
MarketPro is a production-ready multi-vendor e-commerce platform on Laravel 12. It requires no Node.js, no npm, and no build step β all frontend assets load via CDN. One Artisan command installs everything.
βοΈ Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| PHP | 8.1 | 8.2 or 8.3 |
| Laravel | 12.x (included) | |
| Database | MySQL 5.7 / SQLite 3 | MySQL 8.0+ |
| Composer | 2.x | Latest |
| Node.js / npm | Not required | |
| PHP Extensions | pdo, mbstring, openssl, tokenizer, xml, curl, gd, fileinfo, zip | |
| Web Server | Apache / Nginx | Nginx + PHP-FPM |
| Memory Limit | 128MB | 256MB+ (for AI features) |
public/ folder. No symlinks required. Works on cPanel and Plesk without any special configuration.π¦ Installation
composer installcp .env.example .env
php artisan key:generateDB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=marketpro
DB_USERNAME=root
DB_PASSWORD=your_passwordphp artisan marketpro:install
# Flags:
# --fresh Drop all tables and reinstall from scratch
# --no-seed Migrate only, skip demo data seedingphp artisan serve
# Open: http://127.0.0.1:8000php artisan config:cache && php artisan route:cache && php artisan view:cache. Ensure public/uploads/ is writable by the web server user.π File Structure
marketpro/
βββ app/
β βββ Console/Commands/
β β βββ InstallCommand.php # marketpro:install
β β βββ MarketProCommands.php # sync-uploads, create-admin, backup, clear-ai-cache
β βββ Helpers/
β β βββ functions.php # setting(), currency_format(), ai_enabled(), theme_css()β¦
β β βββ UploadHelper.php # upload(), delete(), url() β public/uploads/
β βββ Http/Controllers/
β β βββ Admin/ # AdminControllers, MoreAdminControllers, AiControllersβ¦
β β βββ Vendor/VendorControllers.php
β β βββ Customer/ # CartController, CheckoutController, CustomerControllers
β β βββ SubAdmin/DashboardController.php
β β βββ Api/AiChatController.php
β β βββ Auth/AuthController.php
β βββ Http/Middleware/
β β βββ SetLocale.php # Resolves locale: session β user pref β site default
β β βββ ShareViewData.php # Injects cartCount into all views
β β βββ VendorApproved.php # Blocks suspended/unapproved vendors every request
β βββ Models/
β β βββ Models.php # All 30+ Eloquent models
β β βββ AiSetting.php # canUse(), hasApiKey(), getApiKey()
β β βββ Currency.php # 20+ currencies, session-based conversion
β βββ Services/
β βββ AiService.php # 13 AI methods, all with graceful fallbacks
β βββ OrderService.php # createOrder(), updateStatus(), updatePaymentStatus()
β βββ SmsService.php # 5 SMS gateway integrations
β βββ NotificationService.php # In-app + email notifications
βββ database/
β βββ migrations/ # All tables in 2 migration files
β βββ seeders/DatabaseSeeder.php # Demo admin, vendor, customer + all default settings
βββ public/
β βββ uploads/ # Created by installer β 11 subdirectories
β βββ images/payments/ # SVG payment logos
βββ resources/views/ # 103 Blade views across 8 sections
β βββ layouts/ # admin.blade.php, app.blade.php
β βββ admin/ # 49 views
β βββ vendor/ # 10 views
β βββ customer/ # 25 views
β βββ subadmin/ # 4 views
β βββ emails/ # invoice, order-confirmation, order-status-updated
β βββ partials/ # product-card, ai-chat-widget
βββ routes/web.php # All routes, grouped by role with middleware
π User Roles
MarketPro uses Spatie Laravel-Permission. Four roles are seeded automatically.
| Role | URL Prefix | Middleware | Access |
|---|---|---|---|
| admin | /admin | role:admin|sub-admin | Full platform control |
| sub-admin | /sub-admin | role:sub-admin | Permission-restricted subset |
| vendor | /vendor | role:vendor,vendorApproved | Own store management |
| customer | /my-account | auth | Profile, orders, wishlist |
Sub-Admin Permissions
12 granular permissions assignable per sub-admin from Admin β Sub Admins β Edit. The sidebar automatically shows only permitted sections:
manage_products manage_orders manage_customers
manage_vendors manage_categories manage_coupons
manage_banners manage_reports manage_shipping
manage_payments manage_reviews manage_settings
ποΈ Database Models
| Model | Table | Key Relations / Methods |
|---|---|---|
User | users | hasOne Vendor; hasMany Orders, Addresses, Cart, Wishlist, Notifications |
Vendor | vendors | belongsTo User; hasMany Products, Orders, Withdrawals |
Product | products | belongsTo Vendor, Category, Brand; hasMany Images, Variations, Reviews; current_price, discount_percent, effective_free_shipping, effective_return_days |
Order | orders | belongsTo User, Vendor, parentOrder; hasMany Items, StatusHistory, childOrders; status_badge |
OrderItem | order_items | belongsTo Order, Product, Vendor, Variation |
Cart | carts | belongsTo User, Product, ProductVariation |
Coupon | coupons | isValid($subtotal), calculateDiscount($subtotal) |
Setting | settings | get($key, $default), set($key, $value, $group), clearCache() |
Language | languages | scopeActive(), is_default, direction (ltr/rtl) |
Currency | (static class) | getAll(), find($code), active(), convert($amount), symbol() |
AiSetting | ai_settings | canUse($feature), hasApiKey(), getApiKey() |
π¦ Order System
Single vs Multi-Vendor Orders
Single-vendor checkout creates exactly one order row with vendor_id set directly and parent_order_id = null. No child order is created.
Multi-vendor checkout creates a parent order (vendor_id = null) plus one child order per vendor (parent_order_id = parent.id). The parent holds all items for invoicing. The admin orders index filters to whereNull('parent_order_id').
Order Status Flow
pending β confirmed β processing β shipped β out_for_delivery β delivered
β cancelled (from any state)
Each status change creates an OrderStatusHistory record. Customer is notified by email and SMS (if configured) on each transition.
Invoice Generation
Invoices are generated as PDFs using DomPDF. The view is resources/views/emails/invoice.blade.php. Prices display in base currency using base_currency_format() β not the customer's session currency β because invoices reflect the actual charged amount.
β¦ AI Features Reference
All AI features use Claude claude-sonnet-4-6 via the Anthropic API. Each is gated by AiSetting::canUse($feature) which verifies: master switch ON + feature toggle ON + API key present.
ANTHROPIC_API_KEY empty or turn off the master switch.| Feature Key | What it does | Fallback when off |
|---|---|---|
ai_chat_enabled | Customer support widget β knows store policies, customer's orders | Static contact info |
ai_recommendations_enabled | Personalised product recommendations from purchase history | Top sellers by count |
ai_smart_search_enabled | NLP search β parses natural language, extracts price/attribute filters | Standard LIKE search |
ai_description_enabled | Generates product description, short desc, meta title, meta desc, tags | Manual text fields |
ai_seo_enabled | SEO optimisation suggestions for existing products | Manual fields |
ai_forecast_enabled | 30-day revenue forecast from 90 days of historical order data | Simple 30-day average |
ai_fraud_enabled | Fraud risk scoring per order: Low/Medium/High/Critical + reasoning | Auto-approve all orders |
ai_pricing_enabled | Suggests optimal price based on category, competition, cost | Manual pricing |
ai_inventory_enabled | Recommends reorder points and quantities per product | Manual threshold |
ai_email_enabled | Personalised email content for order confirmations | Standard templates |
ai_vendor_insights_enabled | Vendor performance narrative: strengths, risks, recommendations | Raw metrics display |
ai_review_analysis_enabled | Sentiment analysis + summary across all product reviews | Raw review list |
ai_translate_enabled | Enhanced translation quality for language strings | Free Google Translate |
Enabling AI
# .env β only these two lines needed
ANTHROPIC_API_KEY=sk-ant-api03-...
ANTHROPIC_MODEL=claude-sonnet-4-6 # optional, this is the default
Then go to Admin β AI Features and toggle the master switch ON. Individual features can be toggled independently.
π³ Payment Gateways
Configure all gateways from Admin β Payments β Payment Gateways. Credentials store in the database β no .env editing required after initial setup.
| Gateway | Type | Required Config |
|---|---|---|
| Stripe | Card / Wallets | Publishable Key, Secret Key, Webhook Secret |
| PayPal | PayPal / Card | Client ID, Client Secret, Mode (sandbox/live) |
| Razorpay | Card / UPI / Net Banking | Key ID, Key Secret |
| Flutterwave | Card / Mobile Money / Bank | Public Key, Secret Key, Encryption Key |
| Cash on Delivery | Offline | None required |
| Bank Transfer | Offline | Bank account details (shown as instructions to customer) |
π Multi-Language
Language strings are stored as JSON files in resources/lang/{code}.json. The admin language manager (Admin β Languages) allows adding, editing, auto-translating, and toggling languages.
Adding a Language
fr), direction (LTR/RTL), and optionally a flag image.π± Multi-Currency
MarketPro ships with 20 pre-configured currencies. Prices are stored in your base currency. When a customer switches currency, prices are converted in real-time using session-stored exchange rates.
How it works
// Customer switches to EUR β stored in session:
currency_code = "EUR"
currency_symbol = "β¬"
currency_rate = 0.92 // multiplied against USD base price
// currency_format() applies the conversion automatically
currency_format(100.00) // β "β¬92.00"
// base_currency_format() always shows base currency (for invoices, admin)
base_currency_format(100.00) // β "$100.00"
Enable the frontend switcher in Admin β Settings β General β Enable Multi-Currency Switcher. Customers then see a currency dropdown in the site header.
π File Uploads
All uploads go to public/uploads/ with sub-directories per content type. This means no storage:link symlink is needed β files are directly accessible as public assets.
public/uploads/
βββ products/ # Product thumbnails and gallery images
βββ avatars/ # User profile photos
βββ vendors/ # Vendor logos and store banners
βββ categories/ # Category images
βββ branding/ # Site logo, favicon
βββ banners/ # Homepage banners
βββ flags/ # Language flag images
βββ reviews/ # Review photos
βββ brands/ # Brand logos
βββ pages/ # CMS page images
βββ payments/ # Payment confirmation screenshots
The UploadHelper class handles all file operations. Use upload_url($path) in Blade to get the full URL with fallback to a placeholder image.
π§ Environment Variables
| Variable | Required | Description |
|---|---|---|
APP_KEY | Yes | Generated by php artisan key:generate |
DB_* | Yes | Database connection credentials |
ANTHROPIC_API_KEY | AI only | Anthropic API key for Claude AI features |
ANTHROPIC_MODEL | Optional | Default: claude-sonnet-4-6 |
MAIL_* | SMTP credentials for transactional email | |
GOOGLE_CLIENT_ID | Optional | Google OAuth β for customer login with Google |
GOOGLE_CLIENT_SECRET | Optional | Google OAuth secret |
GOOGLE_REDIRECT_URI | Optional | Default: /auth/google/callback |
.env. Configure them after installation via Admin β Payments and Admin β SMS Gateways.π» Artisan Commands
| Command | Description |
|---|---|
marketpro:install | Full install: create dirs, migrate, seed, create lang file, clear caches. Use --fresh to drop+reinstall, --no-seed to skip seeding. |
marketpro:sync-uploads | Re-create any missing upload sub-directories in public/uploads/ |
marketpro:create-admin | Interactive: create or update a super admin account by email |
marketpro:clear-ai-cache | Flush all AI response caches. Add --reset-stats to also reset usage counters. |
marketpro:backup | MySQL dump to storage/backups/backup-YYYY-MM-DD-HHmmss.sql |
π¨ Branding & Theme
Go to Admin β Branding & Theme to customise the visual identity without touching code. All settings are applied via CSS custom properties injected by the theme_css() helper function in every layout.
| Setting | Options |
|---|---|
| Primary Color | 8 presets + custom hex (#rrggbb) |
| Secondary Color | Custom hex |
| Accent Color | Custom hex |
| Font Family | 10 Google Fonts (Inter, Poppins, Roboto, etc.) |
| Border Radius | None / Small / Medium / Large / XL / Full (pill) |
| Logo | Upload PNG/SVG (max 2MB) |
| Favicon | Upload ICO/PNG (max 512KB) |
π© Helper Functions
| Function | Returns | Description |
|---|---|---|
setting($key, $default) | mixed | Read setting from DB with 1-hour cache. Falls back to $default if not found. |
currency_format($amount) | string | Format and convert amount using active session currency. E.g. $84.99 or β¬78.19 |
base_currency_format($amount) | string | Format in base site currency only. Used for invoices, admin panels, stored prices. |
ai_enabled($feature) | bool | Returns true only if master switch ON + feature toggle ON + API key set |
ai_has_key() | bool | True if ANTHROPIC_API_KEY is configured and non-empty |
upload_url($path, $placeholder) | string | Full URL to an uploaded file, with optional placeholder image if path is null |
app_name() | string | Site name from settings, falls back to config app.name |
app_logo() | string | Full URL to site logo; falls back to /images/logo.png |
primary_color() | string | Primary hex color from settings. Default: #6366f1 |
theme_css() | string | CSS custom properties block β output directly in <style> tags in layout head |
is_rtl() | bool | True if current locale language is RTL |
generate_order_number() | string | Unique order number with configurable prefix. E.g. ORD-A8F3D2 |
π Demo Credentials
| Role | Password | Panel URL | |
|---|---|---|---|
| Super Admin | admin@marketpro.com | Admin@12345 | /admin |
| Vendor | vendor@marketpro.com | Vendor@12345 | /vendor |
| Customer | customer@marketpro.com | Customer@12345 | /login |
π¨ Troubleshooting
jQuery must load before Bootstrap JS and Summernote. The admin layout injects jQuery in
<head>. If you add custom scripts, always keep jQuery first.Go to Admin β Settings β General and set your Currency Symbol (e.g.
$). The system always falls back to $ if empty, but it's best to set it explicitly.This is fixed in the current version. Single-vendor orders now create exactly one row. Run
php artisan cache:clear if you see unexpected behaviour.Run
php artisan marketpro:sync-uploads to recreate directories. Ensure your web server user owns public/uploads/: chown -R www-data:www-data public/uploadsphp artisan cache:clear && php artisan view:clear && php artisan route:clear && php artisan config:clearANTHROPIC_API_KEY is set in .env, (2) the master AI switch is ON in Admin β AI Features, and (3) the specific feature toggle is ON.