laravel-project/prompt_two.md

77 lines
3.7 KiB
Markdown

# Master Project Prompt: Club Hub Marketplace
## 1. Core Objective
Build a **Multi-tenant SaaS Marketplace** where various sports clubs (like "Torox") can host their own management systems.
* **Tech Stack:** Laravel (PHP 8+), MySQL, **Laravel Blade Templates**, and **Bootstrap 5**.
* **Frontend Philosophy:** No SPAs (Vue/React). Use server-side rendering with Blade for speed and simplicity. Use **Bootstrap** for all UI components.
* **Multi-Tenancy:** Implement a "Single Database" approach where every entity (except global users/clubs) belongs to a `club_id`.
---
## 2. Enhanced Database Schema (Multi-Tenant)
### Core Multi-Tenant Structure
* **clubs:** `id`, `name`, `slug` (unique), `logo_path`, `cover_image`, `description`, `address`, `owner_id` (FK to users), `settings` (JSON for 'pay_later' toggle), `is_active`, `timestamps`.
* **Trait Implementation:** Create a `BelongsToClub` trait. This trait must apply a **Global Scope** to filter queries by `club_id` and automatically assign the `club_id` when creating records.
### Updated Tables (All must include `club_id`)
* **users:** Standard fields + `role` ('super_admin', 'club_admin', 'customer', 'trainer').
* **packages:** Name, price, duration, type (fixed/flexible), restrictions (age/gender), and `club_id`.
* **activities & schedules:** Linked to `club_id`.
* **subscriptions & payments:** Linked to `user_id`, `package_id`, and `club_id`.
* **family_relation_history:** Track parent/child links within a club context.
---
## 3. Key Feature Implementation (Blade + Bootstrap)
### A. The Three-Tier Interface
1. **Marketplace Landing:** A Bootstrap-styled homepage listing all clubs.
2. **Club Public Profile:** `/club/{slug}`. A showcase page for each club showing their specific packages and a "Join" button.
3. **Tenant Dashboard:** A private area for Club Admins to manage *their* members, schedules, and verify payments.
### B. User & Family Management
* **Auth:** Dual login (Email or Mobile).
* **Sub-Accounts:** Customers can create "Child" accounts (no credentials).
* **Adoption Flow:** Customers can "Adopt" an existing user via a confirmation request.
* **Promotion:** Convert a child account to an independent user by adding email/password.
### C. Enrollment & "Pay Later" Logic
* **Logic:** Check `club->settings['pay_later']`.
* **Enabled:** Subscription = `active`, Payment = `pending_payment`.
* **Disabled:** User must upload a Bootstrap-styled file input (Proof of Payment). Status = `pending_verification`.
* **Admin Verification:** A "Verification Queue" view where admins view the `proof_image_path` and approve/reject with notes.
### D. Booking System
* For **Flexible** packages: Ensure `sessions_remaining > 0` and `schedule->capacity > 0`.
* Use a Bootstrap-themed calendar or list view for members to book slots.
---
## 4. Automation & Logging
* **Daily Reminders:** A Laravel Command `club:remind-unpaid` to notify users across all clubs who have `unpaid` payment statuses.
* **Action Logging:** A Trait/Middleware to log all interactions (Logins, Bookings, Payments) into `user_action_logs` with a JSON payload of the changes.
---
## 5. Implementation Steps for AI
1. **Base Setup:** Install Laravel + **Bootstrap**.
2. **Tenancy:** Create `Club` model and the `BelongsToClub` trait.
3. **Migrations:** Build the database according to the Multi-Tenant schema.
4. **Blade Layouts:** Create a master Bootstrap layout with a sidebar for admins and a navbar for customers.
5. **Routes:** Define Marketplace routes, Club Profile routes, and Dashboard routes.
6. **Controllers:** Implement the logic for Family, Payments, and Bookings.
**Would you like me to start by writing the `Club` model, the `BelongsToClub` trait, and the first migration to set up the multi-tenant foundation?**