🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 01:08
This commit is contained in:
38
scripts/seed.php
Normal file
38
scripts/seed.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use App\Core\{Application, Database};
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
$app = new Application(dirname(__DIR__));
|
||||
$db = Database::getInstance();
|
||||
|
||||
echo "🌱 Seeding initial data...\n";
|
||||
|
||||
try {
|
||||
// 1. Create Tenant
|
||||
$tenantId = Uuid::uuid4()->toString();
|
||||
$db->prepare("INSERT INTO tenants (id, name, email, status) VALUES (?, ?, ?, 'active')")
|
||||
->execute([$tenantId, 'شركة انطلاق للحلول الرقمية', 'admin@intaleqapp.com']);
|
||||
|
||||
// 2. Create Super Admin User
|
||||
$userId = Uuid::uuid4()->toString();
|
||||
$passwordHash = password_hash('Musadaq@2026', PASSWORD_ARGON2ID);
|
||||
|
||||
$db->prepare("INSERT INTO users (id, tenant_id, name, email, password_hash, role, is_active) VALUES (?, ?, ?, ?, ?, 'super_admin', 1)")
|
||||
->execute([$userId, $tenantId, 'Hamza Admin', 'admin@musadaq.app', $passwordHash]);
|
||||
|
||||
// 3. Create initial subscription
|
||||
$db->prepare("INSERT INTO subscriptions (tenant_id, plan, max_companies, max_invoices_per_month, max_users) VALUES (?, 'pro', 10, 500, 5)")
|
||||
->execute([$tenantId]);
|
||||
|
||||
echo "✅ Success! You can now log in with:\n";
|
||||
echo "📧 Email: admin@musadaq.app\n";
|
||||
echo "🔑 Password: Musadaq@2026\n";
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
echo "❌ Error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user