Skip to content

codezelat/laravel-form-creation-system

Repository files navigation

πŸ“‹ Laravel Dynamic Form Builder System

Laravel PHP Tailwind CSS License

A powerful, intuitive form builder system built with Laravel 12 that enables creation, management, and analysis of dynamic forms with advanced submission tracking and export capabilities.

Features β€’ Installation β€’ Usage β€’ Documentation β€’ Contributing


πŸ“– Table of Contents


🎯 Overview

The Laravel Dynamic Form Builder System is a comprehensive solution for creating and managing custom forms with a drag-and-drop interface. Built for organizations that need to collect data efficiently, this system offers enterprise-grade features including real-time validation, spam protection, advanced analytics, and intelligent field matching for form evolution.

Why Use This System?

  • 🎨 Visual Form Builder: Create complex forms without writing code
  • πŸ“Š Real-time Analytics: Track submission patterns and insights
  • πŸ”’ Security First: Built-in CAPTCHA and spam protection
  • πŸ“ˆ Export Capabilities: Generate Excel reports with one click
  • πŸ”„ Backward Compatibility: Intelligent field matching handles form modifications
  • ⚑ Auto-save: Never lose your work with automatic draft saving
  • πŸ“± Responsive Design: Perfect experience on all devices

✨ Features

Form Building

  • 🎨 Drag-and-Drop Interface: Intuitive visual form builder with live preview
  • πŸ“ Multiple Field Types:
    • Short text input
    • Long text (textarea)
    • Dropdown select
    • Radio buttons
    • Checkboxes
    • File uploads
    • Email validation
    • Number input
    • Date picker
  • 🎨 Theme Customization: 6 color themes (Blue, Green, Purple, Red, Yellow, Indigo)
  • βš™οΈ Field Configuration:
    • Required/optional fields
    • Custom labels
    • Option management for select/radio/checkbox
    • File type restrictions and size limits
    • Drag-to-reorder fields

Form Management

  • πŸ“Š Dashboard Overview: Real-time statistics and recent forms
  • πŸ” Search & Filter: Find forms quickly with advanced search
  • πŸ“€ Publish/Unpublish: Control form visibility and access
  • πŸ”— Custom URLs: SEO-friendly slugs for each form
  • πŸ—‘οΈ Safe Deletion: Automatic cleanup of associated files and submissions
  • ⏰ Auto-save: Changes saved automatically every few seconds

Submission Handling

  • πŸ›‘οΈ Cloudflare Turnstile: Bot protection for all public forms
  • πŸ“₯ File Upload Support: Secure file storage with validation
  • 🌐 IP Tracking: Record submitter information for analytics
  • πŸ“Έ Field Snapshots: Maintain historical accuracy when forms change
  • πŸ” Detailed View: Examine individual submissions with full context

Analytics & Reporting

  • πŸ“Š Submission Analytics:
    • Total submissions count
    • Today's submissions
    • Weekly trends
    • Time-based charts
  • πŸ“‹ Paginated Results: Easy navigation through large datasets
  • πŸ” Search Submissions: Find specific responses quickly
  • πŸ“Š Excel Export: One-click export with:
    • Professional formatting
    • Clickable file links
    • Auto-sized columns
    • Color-coded headers
    • Required field indicators

Security Features

  • πŸ” Admin Authentication: Environment-based secure login
  • πŸ›‘οΈ CSRF Protection: Laravel's built-in security
  • πŸ€– Bot Prevention: Cloudflare Turnstile integration
  • πŸ”’ Hidden Admin Panel: Obscured URL path (/hidden-admin)
  • πŸ“ Audit Trail: IP and user agent logging
  • 🚫 Status Controls: Active/inactive form states

Developer Features

  • πŸ”„ Backward Compatibility: Intelligent field matching for form modifications
  • πŸ› οΈ Artisan Commands: CLI tools for maintenance
  • πŸ“¦ Modular Architecture: Clean, maintainable code structure
  • 🎯 RESTful API: JSON responses for all operations
  • πŸ§ͺ Testing Ready: PHPUnit configured and ready
  • πŸ“š Well Documented: Comprehensive inline documentation

πŸ› οΈ Technology Stack

Backend

  • Laravel 12.0 - PHP framework with latest features
  • PHP 8.2+ - Modern PHP with improved performance
  • SQLite - Default database (MySQL/PostgreSQL supported)
  • Doctrine DBAL - Database abstraction layer
  • Maatwebsite Excel - Excel export functionality

Frontend

  • Tailwind CSS 4.1 - Utility-first CSS framework
  • Vite 7.0 - Lightning-fast frontend tooling
  • Alpine.js (via Laravel) - Minimal JavaScript framework
  • Axios - HTTP client for AJAX requests
  • SortableJS - Drag-and-drop functionality

Services & Tools

  • Cloudflare Turnstile - Bot protection
  • Laravel Vite Plugin - Asset bundling
  • Concurrently - Development server management
  • Laravel Pail - Real-time log viewing

Development Tools

  • Laravel Pint - Code style fixer
  • PHPUnit - Testing framework
  • Faker - Test data generation
  • Laravel Sail - Docker development environment

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     User Interface Layer                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Public Forms        β”‚     Admin Panel (Hidden URL)          β”‚
β”‚  - Form Display      β”‚     - Dashboard                       β”‚
β”‚  - Submission        β”‚     - Form Builder                    β”‚
β”‚  - Turnstile         β”‚     - Analytics                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚                         β”‚
               β–Ό                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Controller Layer                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  FormController      β”‚     AdminAuthController               β”‚
β”‚  - CRUD Operations   β”‚     - Authentication                  β”‚
β”‚  - Submissions       β”‚     - Dashboard Data                  β”‚
β”‚  - File Handling     β”‚     - Export Management               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚                         β”‚
               β–Ό                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Service Layer                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  TurnstileService    β”‚     FormSubmissionsExport             β”‚
β”‚  - Bot Verification  β”‚     - Excel Generation                β”‚
β”‚  - API Integration   β”‚     - Data Formatting                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚                         β”‚
               β–Ό                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       Model Layer                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Form Model          β”‚  FormField Model  β”‚  FormSubmission   β”‚
β”‚  - Relationships     β”‚  - Validation     β”‚  - Field Snapshot β”‚
β”‚  - Auto-slug         β”‚  - Ordering       β”‚  - Smart Matching β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Database Layer                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  forms              β”‚  form_fields      β”‚  form_submissions  β”‚
β”‚  - Title, Slug      β”‚  - Type, Label    β”‚  - Data, Snapshot  β”‚
β”‚  - Status, Color    β”‚  - Options        β”‚  - Files, Metadata β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Installation

Prerequisites

Ensure your system meets these requirements:

  • PHP >= 8.2
  • Composer >= 2.0
  • Node.js >= 18.0
  • NPM or Yarn
  • SQLite (or MySQL/PostgreSQL)
  • Git

Step-by-Step Installation

1. Clone the Repository

git clone https://github.com/yourusername/laravel-form-creation-system.git
cd laravel-form-creation-system

2. Install PHP Dependencies

composer install

3. Install Node Dependencies

npm install

4. Environment Configuration

# Copy environment file
cp .env.example .env

# Generate application key
php artisan key:generate

5. Configure Environment Variables

Edit .env file with your settings:

# Application
APP_NAME="Form Builder System"
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost:8000

# Database (SQLite by default)
DB_CONNECTION=sqlite

# Admin Credentials
ADMIN_USERNAME=admin
ADMIN_PASSWORD=your-secure-password

# Cloudflare Turnstile (Required for public forms)
TURNSTILE_SITE_KEY=your-site-key
TURNSTILE_SECRET_KEY=your-secret-key

# Session (Required for admin authentication)
SESSION_DRIVER=database

6. Create Database

For SQLite (default):

touch database/database.sqlite

For MySQL:

# Create database manually
mysql -u root -p -e "CREATE DATABASE form_builder;"

7. Run Migrations

php artisan migrate

8. Create Storage Link

php artisan storage:link

9. Build Frontend Assets

# Development
npm run dev

# Production
npm run build

10. Start Development Server

# Option 1: Simple server
php artisan serve

# Option 2: Full development stack (recommended)
composer run dev

The application will be available at http://localhost:8000


βš™οΈ Configuration

Cloudflare Turnstile Setup

Cloudflare Turnstile provides free bot protection:

  1. Visit Cloudflare Turnstile Dashboard
  2. Create a new site
  3. Copy your Site Key and Secret Key
  4. Add to .env:
TURNSTILE_SITE_KEY=1x00000000000000000000AA
TURNSTILE_SECRET_KEY=1x0000000000000000000000000000000AA

Admin Authentication

Set strong credentials in .env:

ADMIN_USERNAME=your-admin-username
ADMIN_PASSWORD=your-secure-password-here

Important: In production, use a strong password with:

  • Minimum 12 characters
  • Mix of uppercase and lowercase
  • Numbers and special characters

Database Configuration

SQLite (Default)

DB_CONNECTION=sqlite

MySQL

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=form_builder
DB_USERNAME=root
DB_PASSWORD=your-password

PostgreSQL

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=form_builder
DB_USERNAME=postgres
DB_PASSWORD=your-password

File Upload Configuration

Configure file upload limits in php.ini:

upload_max_filesize = 10M
post_max_size = 10M

Or in .env for Laravel Valet:

UPLOAD_MAX_FILESIZE=10485760

Queue Configuration

For better performance with file uploads:

QUEUE_CONNECTION=database

Run queue worker:

php artisan queue:work

πŸ“š Usage Guide

Accessing the Admin Panel

  1. Navigate to http://localhost:8000/hidden-admin
  2. Login with credentials from .env
  3. You'll be redirected to the dashboard

Creating Your First Form

Step 1: Navigate to Form Builder

  • Click "Create New Form" on the dashboard
  • Or go to /hidden-admin/forms/create

Step 2: Configure Form Settings

  • Title: Enter a descriptive form title
  • Description: Add optional instructions
  • Theme Color: Choose from 6 color schemes

Step 3: Add Fields

Click field types from the sidebar:

  • Short Text: Single-line input
  • Long Text: Multi-line textarea
  • Dropdown: Select from options
  • Radio Buttons: Single choice from options
  • Checkboxes: Multiple selections
  • File Upload: Document/image uploads
  • Email: Validated email input
  • Number: Numeric input only
  • Date: Date picker

Step 4: Configure Each Field

  • Label: Field name visible to users
  • Required: Toggle mandatory fields
  • Options: For dropdown/radio/checkbox (one per line)
  • File Settings: For file uploads:
    • Accepted types (comma-separated)
    • Maximum size in MB

Step 5: Reorder Fields

  • Drag and drop fields to reorder
  • Use the drag handle on the left

Step 6: Save and Publish

  • Changes auto-save as drafts
  • Click "Publish Form" when ready
  • Choose form status:
    • Active: Accepts submissions
    • Inactive: Visible but locked
  • Optionally customize the URL slug

Managing Forms

View All Forms

Navigate to /hidden-admin/forms:

  • See all forms with submission counts
  • Search by title or description
  • Quick actions: View, Analytics, Export, Delete

Edit Form

  • Click form title or edit icon
  • Modify fields and settings
  • Changes save automatically
  • Re-publish to update live version

View Analytics

Click "Analytics" on any form:

  • Metrics: Total, today, and weekly submissions
  • Submission List: Paginated with search
  • Individual View: Click any submission for details

Export Submissions

  • Click "Export" button in analytics
  • Downloads formatted Excel file with:
    • All submission data
    • Clickable file links
    • Professional styling
    • Timestamp information

Viewing Submissions

Submission List

  • Shows recent submissions
  • Displays preview of responses
  • Click to view full details

Submission Details

  • Complete response data
  • Field labels and values
  • Downloadable file attachments
  • Submitter metadata (IP, user agent)
  • Submission timestamp

Form Statuses

Draft

  • Form is being created/edited
  • Not publicly accessible
  • Can be edited freely

Published - Active

  • Live and accepting submissions
  • Publicly accessible via URL
  • Protected by Turnstile

Published - Inactive

  • Visible but not accepting submissions
  • Shows "locked" message to users
  • Admins can still view

Public Form Submissions

User Experience

  1. User visits form URL (e.g., /form/contact-us-abc123)
  2. Sees branded form with SITC styling
  3. Fills out required fields
  4. Completes Turnstile verification
  5. Submits form
  6. Sees success message

File Uploads

  • Files stored in /storage/app/public/submissions/{form_id}/{submission_id}/
  • Validated against allowed types and size
  • Unique filenames prevent conflicts

πŸ”Œ API Reference

Admin Routes

All admin routes require authentication and are prefixed with /hidden-admin.

Authentication

POST /hidden-admin
Content-Type: application/x-www-form-urlencoded

username=admin&password=secret

Create/Update Form

POST /hidden-admin/forms/store
Content-Type: application/json

{
  "id": null,
  "title": "Contact Form",
  "description": "Get in touch with us",
  "color": "blue",
  "fields": [
    {
      "type": "text",
      "label": "Full Name",
      "required": true
    },
    {
      "type": "email",
      "label": "Email Address",
      "required": true
    }
  ]
}

Response:

{
  "success": true,
  "form_id": 1,
  "message": "Form saved successfully"
}

Publish Form

POST /hidden-admin/forms/{id}/publish
Content-Type: application/json

{
  "slug": "contact-us",
  "form_status": "active"
}

Response:

{
  "success": true,
  "slug": "contact-us-abc123",
  "url": "http://localhost:8000/form/contact-us-abc123"
}

Get Form Data

GET /hidden-admin/forms/{id}/data

Response:

{
  "success": true,
  "form": {
    "id": 1,
    "title": "Contact Form",
    "fields": [...]
  }
}

Delete Form

DELETE /hidden-admin/forms/{id}

Public Routes

View Form

GET /form/{slug}

Submit Form

POST /form/{slug}/submit
Content-Type: multipart/form-data

field_1=John+Doe&
field_2=john@example.com&
cf-turnstile-response=token

Response:

{
  "success": true,
  "message": "Form submitted successfully!"
}

πŸ”’ Security Features

Authentication

  • Session-based admin authentication
  • Environment variables for credentials
  • Hidden admin URL to prevent discovery
  • CSRF protection on all forms

Bot Protection

  • Cloudflare Turnstile on all public forms
  • Server-side token verification
  • IP address logging
  • Rate limiting capable

File Upload Security

  • Type validation (whitelist approach)
  • Size restrictions per field
  • Unique storage paths
  • Automatic cleanup on deletion

Data Protection

  • SQL injection prevention via Eloquent ORM
  • XSS protection via Blade templating
  • Mass assignment protection via $fillable
  • Input validation on all endpoints

Best Practices

  • Environment-based configuration
  • Secure session handling
  • Regular security updates
  • Error logging without exposure

πŸš€ Advanced Features

Field Snapshot System

The most sophisticated feature enabling backward compatibility:

The Problem

When a form is modified after receiving submissions:

  • Field IDs change
  • Field order changes
  • Fields are added/removed
  • Old submissions become unreadable

The Solution

Field Snapshots - Every submission stores the form structure at submission time:

{
  "field_snapshot": [
    {
      "id": 1,
      "type": "text",
      "label": "Full Name",
      "order": 0,
      "required": true
    },
    {
      "id": 2,
      "type": "email",
      "label": "Email",
      "order": 1,
      "required": true
    }
  ]
}

Intelligent Matching Algorithm

When displaying old submissions, the system uses a scoring algorithm:

Score Components:
- Label Match (60%): Exact or similar text
- Type Match (20%): Same field type
- Position Match (10%): Same order in form
- Required Status (5%): Same required flag
- Options Similarity (5%): For select/radio/checkbox

Example: If "Full Name" field is later renamed to "Name", the system:

  1. Calculates similarity: 75% match
  2. Confidence threshold: 50%
  3. Result: Successfully matches and displays data

Backfill Command

For existing installations without snapshots:

# Preview changes
php artisan submissions:backfill-snapshots --dry-run

# Apply changes
php artisan submissions:backfill-snapshots

Auto-Save System

Forms save automatically while building:

  • Frequency: Every 5 seconds of inactivity
  • Status: Visual indicator shows save state
  • Draft Mode: All changes saved as drafts
  • No Data Loss: Continue where you left off

Excel Export Features

Professional exports with:

  • Formatted Headers: Bold, colored background
  • Auto-sized Columns: Perfect width for content
  • Clickable Links: File uploads become hyperlinks
  • Required Indicators: Asterisk (*) on required fields
  • Metadata: Submission ID, date, time, IP, user agent
  • Custom Styling: Professional appearance

Form Status Management

Three-tier status system:

Draft β†’ Published (Active) β†’ Published (Inactive)
  ↓           ↓                      ↓
Hidden    Accepting            Visible but
          Submissions          Locked

Benefits:

  • Draft: Work in progress, private
  • Active: Fully operational
  • Inactive: Temporarily disable without unpublishing

πŸ’Ύ Database Schema

Tables Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     forms        β”‚         β”‚   form_fields    β”‚         β”‚ form_submissions  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ id               │────┐    β”‚ id               β”‚     β”Œβ”€β”€β”€β”‚ id                β”‚
β”‚ title            β”‚    β”‚    β”‚ form_id          │────┐│   β”‚ form_id           β”‚
β”‚ description      β”‚    └───→│ type             β”‚    β”‚β”‚   β”‚ submission_data   β”‚
β”‚ color            β”‚         β”‚ label            β”‚    β”‚β”‚   β”‚ field_snapshot    β”‚
β”‚ slug (unique)    β”‚         β”‚ required         β”‚    β”‚β”‚   β”‚ files             β”‚
β”‚ status           β”‚         β”‚ options          β”‚    β”‚β”‚   β”‚ ip_address        β”‚
β”‚ form_status      β”‚         β”‚ file_settings    β”‚    β”‚β”‚   β”‚ user_agent        β”‚
β”‚ settings         β”‚         β”‚ order            β”‚    β”‚β”‚   β”‚ submitted_at      β”‚
β”‚ timestamps       β”‚         β”‚ timestamps       β”‚    β”‚β”‚   β”‚ timestamps        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β–²                  β”‚β”‚
                                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
                                                       β”‚
                                   Form has many β”€β”€β”€β”€β”€β”˜
                                   submissions

Detailed Schema

forms Table

Column Type Description
id bigint Primary key
title varchar(255) Form display name
description text Optional form instructions
color varchar(50) Theme color (blue, green, etc.)
slug varchar(255) Unique URL identifier
status enum draft or published
form_status enum active or inactive
settings json Additional configuration
created_at timestamp Creation date
updated_at timestamp Last modified date

form_fields Table

Column Type Description
id bigint Primary key
form_id bigint Foreign key to forms
type varchar(50) Field type (text, email, etc.)
label varchar(255) Field display name
required boolean Mandatory field flag
options json Options for select/radio/checkbox
file_settings json Upload restrictions
order integer Display position
created_at timestamp Creation date
updated_at timestamp Last modified date

form_submissions Table

Column Type Description
id bigint Primary key
form_id bigint Foreign key to forms
submission_data json All field responses
field_snapshot json Form structure at submission
files json Uploaded file paths
ip_address varchar(45) Submitter IP
user_agent text Browser information
submitted_at timestamp Submission date/time
created_at timestamp Record creation
updated_at timestamp Last modified

Relationships

// Form Model
public function fields(): HasMany
public function submissions(): HasMany

// FormField Model
public function form(): BelongsTo

// FormSubmission Model
public function form(): BelongsTo

πŸ› Troubleshooting

Common Issues

Issue: "Target class [AdminAuth] does not exist"

Solution: Clear configuration cache

php artisan config:clear
php artisan cache:clear

Issue: "Vite manifest not found"

Solution: Build frontend assets

npm run build

Issue: "Storage directory not found"

Solution: Create storage link

php artisan storage:link
chmod -R 775 storage

Issue: Admin login not working

Solution: Check environment variables

# Verify .env has correct values
grep "ADMIN_" .env

# Clear session data
php artisan session:flush

Issue: Turnstile verification fails

Solution:

  1. Verify keys in .env are correct
  2. Check domain is allowed in Cloudflare dashboard
  3. Test with different IP (some IPs may be blocked)
  4. Check logs: storage/logs/laravel.log

Issue: File uploads failing

Solution:

# Check permissions
chmod -R 775 storage/app/public

# Verify storage link exists
ls -la public/storage

# Check PHP upload limits
php -i | grep upload_max_filesize

Issue: Database connection error

Solution:

# For SQLite
touch database/database.sqlite
chmod 664 database/database.sqlite

# For MySQL
php artisan migrate:fresh

Debug Mode

Enable detailed error messages:

APP_DEBUG=true
LOG_LEVEL=debug

View real-time logs:

php artisan pail

Performance Issues

Optimize Application

php artisan optimize
php artisan config:cache
php artisan route:cache
php artisan view:cache

Clear All Caches

php artisan optimize:clear

πŸ§ͺ Testing

Running Tests

# Run all tests
php artisan test

# Run specific test file
php artisan test --filter FormControllerTest

# Run with coverage
php artisan test --coverage

Creating Tests

# Generate test class
php artisan make:test FormSubmissionTest

Example test:

public function test_form_can_be_created()
{
    $response = $this->post('/hidden-admin/forms/store', [
        'title' => 'Test Form',
        'color' => 'blue',
        'fields' => [
            ['type' => 'text', 'label' => 'Name', 'required' => true]
        ]
    ]);

    $response->assertStatus(200);
    $this->assertDatabaseHas('forms', ['title' => 'Test Form']);
}

🀝 Contributing

We welcome contributions! Here's how you can help:

Getting Started

  1. Fork the repository
  2. Clone your fork
git clone https://github.com/yourusername/laravel-form-creation-system.git
  1. Create a feature branch
git checkout -b feature/amazing-feature
  1. Commit your changes
git commit -m 'Add amazing feature'
  1. Push to the branch
git push origin feature/amazing-feature
  1. Open a Pull Request

Coding Standards

  • Follow PSR-12 coding standard
  • Use Laravel best practices
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation as needed

Run Code Style Fixer

./vendor/bin/pint

Areas for Contribution

  • πŸ› Bug fixes
  • ✨ New field types
  • 🌐 Translations
  • πŸ“ Documentation improvements
  • 🎨 UI/UX enhancements
  • ⚑ Performance optimizations
  • πŸ§ͺ Additional tests

Pull Request Guidelines

  • Clearly describe the problem and solution
  • Include relevant issue numbers
  • Update README if needed
  • Ensure tests pass
  • Follow existing code style

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2025 Laravel Form Builder System

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions...

πŸ‘₯ Authors & Acknowledgments

Core Team

  • Codezela Technologies - System architecture and implementation

Acknowledgments

  • Laravel Team - For the amazing framework
  • Cloudflare - For Turnstile bot protection
  • Tailwind CSS - For the utility-first CSS framework
  • SortableJS - For drag-and-drop functionality
  • Open Source Community - For inspiration and tools

πŸ“ž Support & Contact

Documentation


🌟 Star History

If this project helped you, please consider giving it a ⭐️!


πŸ“Š Project Status

Build Status Maintained PRs Welcome

Current Version: 1.0.0
Last Updated: December 2025


Built with ❀️ using Laravel

⬆ Back to Top

About

A simple customizable form creation and data management system

Topics

Resources

Stars

Watchers

Forks

Contributors