Initial Ladill Give extraction — online giving pages at give.ladill.com.

Donation checkout via Ladill Pay (9% fee), church/giving QR pages, SSO, and platform scan forwarding.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-09 07:25:49 +00:00
co-authored by Cursor
commit 0860b08af7
295 changed files with 37190 additions and 0 deletions
@@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
// Local mirror of the platform identity, keyed by public_id (OIDC sub).
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->uuid('public_id')->unique();
$table->string('name')->nullable();
$table->string('email')->unique();
$table->string('avatar_url')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,101 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('qr_wallets', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->decimal('credit_balance', 10, 4)->default(0);
$table->unsignedInteger('qr_codes_total')->default(0);
$table->unsignedBigInteger('scans_total')->default(0);
$table->string('status', 20)->default('active');
$table->timestamps();
});
Schema::create('qr_documents', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('title')->nullable();
$table->string('disk', 32)->default('qr');
$table->string('path');
$table->string('mime_type', 128)->default('application/pdf');
$table->unsignedBigInteger('size_bytes')->default(0);
$table->unsignedSmallInteger('page_count')->nullable();
$table->timestamps();
$table->index(['user_id', 'created_at']);
});
Schema::create('qr_codes', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('short_code', 16)->unique();
$table->string('type', 32);
$table->string('label');
$table->text('destination_url')->nullable();
$table->foreignId('qr_document_id')->nullable()->constrained('qr_documents')->nullOnDelete();
$table->json('payload')->nullable();
$table->boolean('is_active')->default(true);
$table->string('png_path')->nullable();
$table->string('svg_path')->nullable();
$table->unsignedBigInteger('scans_total')->default(0);
$table->unsignedBigInteger('unique_scans_total')->default(0);
$table->timestamp('last_scanned_at')->nullable();
$table->timestamp('destination_updated_at')->nullable();
$table->timestamps();
$table->index(['user_id', 'created_at']);
$table->index(['user_id', 'is_active']);
});
Schema::create('qr_transactions', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('qr_wallet_id')->constrained()->cascadeOnDelete();
$table->foreignId('qr_code_id')->nullable()->constrained()->nullOnDelete();
$table->string('type', 16);
$table->decimal('amount_ghs', 10, 4);
$table->decimal('balance_after_ghs', 10, 4);
$table->string('reference')->nullable()->index();
$table->string('status', 20)->default('completed');
$table->string('description')->nullable();
$table->json('metadata')->nullable();
$table->timestamps();
$table->index(['qr_wallet_id', 'created_at']);
});
Schema::create('qr_scan_events', function (Blueprint $table) {
$table->id();
$table->foreignId('qr_code_id')->constrained()->cascadeOnDelete();
$table->timestamp('scanned_at');
$table->string('ip_hash', 64)->nullable();
$table->text('user_agent')->nullable();
$table->string('device_type', 32)->nullable();
$table->string('browser', 64)->nullable();
$table->string('os', 64)->nullable();
$table->string('country_code', 8)->nullable();
$table->string('referrer')->nullable();
$table->boolean('is_unique')->default(false);
$table->timestamps();
$table->index(['qr_code_id', 'scanned_at']);
$table->index(['qr_code_id', 'ip_hash']);
});
}
public function down(): void
{
Schema::dropIfExists('qr_scan_events');
Schema::dropIfExists('qr_transactions');
Schema::dropIfExists('qr_codes');
Schema::dropIfExists('qr_documents');
Schema::dropIfExists('qr_wallets');
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('qr_codes', function (Blueprint $table) {
$table->string('short_code', 32)->change();
});
}
public function down(): void
{
Schema::table('qr_codes', function (Blueprint $table) {
$table->string('short_code', 16)->change();
});
}
};
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notifications');
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('qr_team_members', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('account_id')->index();
$table->unsignedBigInteger('user_id')->nullable()->index();
$table->string('email');
$table->string('role', 20)->default('member');
$table->string('status', 20)->default('invited');
$table->string('token', 64)->nullable();
$table->timestamp('accepted_at')->nullable();
$table->timestamps();
$table->unique(['account_id', 'email']);
});
}
public function down(): void
{
Schema::dropIfExists('qr_team_members');
}
};
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('qr_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->string('notify_email')->nullable();
$table->boolean('product_updates')->default(true);
$table->boolean('low_balance_alerts')->default(true);
$table->string('default_type', 32)->nullable();
$table->json('default_style')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('qr_settings');
}
};
@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('give_donations', function (Blueprint $table) {
$table->id();
$table->foreignId('qr_code_id')->constrained('qr_codes')->cascadeOnDelete();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('reference', 32)->unique();
$table->string('collection_type')->nullable();
$table->unsignedInteger('amount_minor');
$table->string('currency', 3)->default('GHS');
$table->unsignedInteger('platform_fee_minor')->default(0);
$table->unsignedInteger('merchant_amount_minor')->default(0);
$table->string('payer_name')->nullable();
$table->string('payer_email')->nullable();
$table->string('payer_phone', 32)->nullable();
$table->string('payer_note')->nullable();
$table->string('status', 16)->default('pending');
$table->string('payment_reference', 64)->nullable()->unique();
$table->timestamp('paid_at')->nullable();
$table->json('metadata')->nullable();
$table->timestamps();
$table->index(['user_id', 'status', 'paid_at']);
$table->index(['qr_code_id', 'status']);
});
}
public function down(): void
{
Schema::dropIfExists('give_donations');
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('give_donations', function (Blueprint $table) {
$table->unsignedBigInteger('pay_order_id')->nullable()->after('id');
});
}
public function down(): void
{
Schema::table('give_donations', function (Blueprint $table) {
$table->dropColumn('pay_order_id');
});
}
};