?php namespace Database\Seeders; use App\Models\User; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; class DatabaseSeeder extends Seeder { public function run(): void { User::updateOrCreate( ['email' => 'admin@finance.test'], [ 'name' => 'Canada Finance Admin', 'phone' => '+12045550101', 'department' => 'Finance and Accounting', 'position' => 'Finance Administrator', 'role' => 'admin', 'status' => 'active', 'password' => Hash::make('Password@123'), ] ); for ($i = 1; $i <= 3; $i++) { User::updateOrCreate( ['email' => "user{$i}@finance.test"], [ 'name' => "Finance User {$i}", 'phone' => '+1204555010' . ($i + 1), 'department' => ['Operations', 'Procurement', 'Administration'][$i - 1], 'position' => 'Staff', 'role' => 'user', 'status' => 'active', 'password' => Hash::make('Password@123'), ] ); } $accounts = [ ['1000', 'Cash at Bank', 'asset', 'bank', 250000, true, true], ['1100', 'Accounts Receivable', 'asset', 'receivable', 0, false, true], ['1200', 'Staff Advances', 'asset', 'advance', 0, false, true], ['2000', 'Accounts Payable', 'liability', 'payable', 0, false, true], ['2100', 'Tax Payable', 'liability', 'tax', 0, false, true], ['3000', 'Owner Equity', 'equity', 'capital', 250000, false, true], ['4000', 'Service Revenue', 'income', 'sales', 0, false, true], ['4100', 'Other Income', 'income', 'other', 0, false, true], ['5000', 'Operating Expenses', 'expense', 'operations', 0, false, true], ['5100', 'Payroll Expense', 'expense', 'payroll', 0, false, true], ['5200', 'Transport Expense', 'expense', 'transport', 0, false, true], ['5300', 'Office Supplies', 'expense', 'office', 0, false, true], ]; foreach ($accounts as [$code, $name, $type, $subtype, $balance, $cash, $system]) { DB::table('chart_of_accounts')->updateOrInsert( ['code' => $code], [ 'name' => $name, 'type' => $type, 'subtype' => $subtype, 'opening_balance' => $balance, 'current_balance' => $balance, 'is_cash_account' => $cash, 'is_system' => $system, 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ] ); } $cashAccountId = DB::table('chart_of_accounts')->where('code', '1000')->value('id'); DB::table('bank_accounts')->updateOrInsert( ['bank_name' => 'Royal Bank of Canada', 'account_name' => 'Movex Canada Finance Main Account'], [ 'chart_of_account_id' => $cashAccountId, 'institution_number' => '003', 'transit_number' => '00001', 'account_number' => '0000000001', 'currency' => 'CAD', 'opening_balance' => 250000, 'current_balance' => 250000, 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ] ); $contacts = [ ['supplier', 'Toronto Office Supplies Ltd', 'accounts@torontooffice.test', '+14165550111', 'ON', 'M5V 2T6'], ['customer', 'Demo Canadian Corporate Client', 'finance@client.test', '+12045550222', 'MB', 'R3C 4T3'], ['supplier', 'Reliable Canadian Transport Vendor', 'billing@transport.test', '+16045550333', 'BC', 'V6B 1A1'], ]; foreach ($contacts as [$type, $name, $email, $phone, $province, $postalCode]) { DB::table('finance_contacts')->updateOrInsert( ['email' => $email], [ 'type' => $type, 'name' => $name, 'phone' => $phone, 'tax_number' => null, 'business_number' => null, 'province' => $province, 'postal_code' => $postalCode, 'address' => 'Canada', 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ] ); } } }