106 lines
3.6 KiB
PHP
106 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class DatabaseSeeder extends Seeder
|
|
{
|
|
use WithoutModelEvents;
|
|
|
|
/**
|
|
* Seed the application's database.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// Create Admin User
|
|
\Illuminate\Support\Facades\DB::table('users')->insert([
|
|
'name' => 'Admin User',
|
|
'email' => 'admin@example.com',
|
|
'password' => \Illuminate\Support\Facades\Hash::make('password'),
|
|
'role' => 'admin',
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
// Call Seeders
|
|
$this->call([
|
|
WorkerCategorySeeder::class,
|
|
SkillSeeder::class,
|
|
EmployerProfileSeeder::class,
|
|
WorkerSeeder::class,
|
|
JobPostSeeder::class,
|
|
]);
|
|
|
|
// Seed Conversations & Messages (assuming IDs exist)
|
|
$conversationId = \Illuminate\Support\Facades\DB::table('conversations')->insertGetId([
|
|
'employer_id' => 2, // From EmployerProfileSeeder
|
|
'worker_id' => 1, // From WorkerSeeder
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
\Illuminate\Support\Facades\DB::table('messages')->insert([
|
|
[
|
|
'conversation_id' => $conversationId,
|
|
'sender_type' => 'employer',
|
|
'sender_id' => 2,
|
|
'text' => 'Hello, are you available for an interview?',
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'conversation_id' => $conversationId,
|
|
'sender_type' => 'worker',
|
|
'sender_id' => 1,
|
|
'text' => 'Yes, I am available.',
|
|
'created_at' => now()->addMinutes(5),
|
|
'updated_at' => now()->addMinutes(5),
|
|
]
|
|
]);
|
|
|
|
// Seed Subscriptions
|
|
\Illuminate\Support\Facades\DB::table('subscriptions')->insert([
|
|
'user_id' => 2, // Employer created in EmployerProfileSeeder
|
|
'plan_id' => 'premium',
|
|
'amount_aed' => 499.00,
|
|
'starts_at' => now(),
|
|
'expires_at' => now()->addMonth(),
|
|
'status' => 'active',
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
// Seed Payments
|
|
\Illuminate\Support\Facades\DB::table('payments')->insert([
|
|
'user_id' => 2, // Employer
|
|
'amount' => 499.00,
|
|
'currency' => 'AED',
|
|
'description' => 'Premium Monthly Subscription',
|
|
'status' => 'success',
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
// Seed Announcements
|
|
\Illuminate\Support\Facades\DB::table('announcements')->insert([
|
|
[
|
|
'title' => 'New Visa Regulations Update',
|
|
'body' => 'The Ministry of Human Resources and Emiratisation has announced updated guidelines for domestic worker sponsorship starting this month.',
|
|
'type' => 'info',
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
],
|
|
[
|
|
'title' => 'Enhanced OCR Verification Active',
|
|
'body' => 'We have deployed upgraded OCR passport verification to ensure 100% legal compliance for all worker profiles on the platform.',
|
|
'type' => 'info',
|
|
'created_at' => now()->subDays(5),
|
|
'updated_at' => now()->subDays(5),
|
|
],
|
|
]);
|
|
}
|
|
}
|