Files
BarangaySystem/database/seeders/UserSeeder.php
Jonathan Sykes 19fec0933b
Some checks failed
tests / PHP 8.2 (swoole-5.1.6) (push) Has been cancelled
tests / PHP 8.3 (swoole-5.1.6) (push) Has been cancelled
tests / PHP 8.4 (swoole-6.0) (push) Has been cancelled
feat: Phase 1 bootstrap — adapt BukidBountyApp as BarangaySystem
- Replace UserTypes with barangay roles (super_admin, punong_barangay,
  kagawad, secretary, treasurer, sk_chairperson, sk_councilor, tanod,
  bhw, daycare_worker, staff, resident, audit)
- Replace UserActions with barangay-specific permissions (residents,
  households, blotters, documents, fee payments, projects, budget)
- Replace modules config with barangay modules (residents, households,
  blotters, documents, certificates, projects, budget, announcements,
  accounting, chapters, qr_payment, subscriptions, landing_pages)
- Update app name, seeders, and landing page to barangay defaults
- Add new enums: DocumentStatus, BlotterStatus, PaymentStatus
- Add 6 new migrations: residents, households, blotters, document
  requests, projects, budget
- Add RequestTypeSeeder with default certificate fee schedule
- Update README with BarangaySystem stack, roles, and remotes
2026-06-06 18:47:20 +08:00

96 lines
3.0 KiB
PHP

<?php
declare(strict_types=1);
use Hyperf\Database\Seeders\Seeder;
use App\Models\User;
use Hypervel\Support\Facades\Hash;
use Hypervel\Support\Str;
class UserSeeder extends Seeder
{
protected $users = [
[
'name' => 'System Administrator',
'mobile_number' => '777',
'nickname' => 'admin',
'username' => 'admin',
'email' => 'admin@example.com',
'password' => 'OmegaPsilon32!',
'acct_type' => 'super_admin',
],
[
'name' => 'Punong Barangay',
'mobile_number' => '09111111111',
'nickname' => 'captain',
'username' => 'test_captain',
'password' => 'TetraOmega21!',
'acct_type' => 'punong_barangay',
],
[
'name' => 'Barangay Secretary',
'mobile_number' => '09222222222',
'nickname' => 'secretary',
'username' => 'test_secretary',
'password' => 'HeliosAlpha21!',
'acct_type' => 'secretary',
],
[
'name' => 'Barangay Treasurer',
'mobile_number' => '09333333333',
'nickname' => 'treasurer',
'username' => 'test_treasurer',
'password' => 'ParagonSigma51!',
'acct_type' => 'treasurer',
],
[
'name' => 'Sample Kagawad',
'mobile_number' => '09444444444',
'nickname' => 'kagawad',
'username' => 'test_kagawad',
'password' => 'MilipedeAstra21!',
'acct_type' => 'kagawad',
],
[
'name' => 'Sample Resident',
'mobile_number' => '09555555555',
'nickname' => 'resident',
'username' => 'test_resident',
'password' => 'OrionDraconis21!',
'acct_type' => 'resident',
],
];
public function run()
{
foreach ($this->users as $data) {
User::firstOrCreate(['mobile_number' => $data['mobile_number']], [
'name' => $data['name'],
'nickname' => $data['nickname'] ?? null,
'username' => $data['username'] ?? null,
'email' => $data['email'] ?? null,
'email_verified_at' => now(),
'mobile_verified_at' => now(),
'password' => Hash::make($data['password']),
'acct_type' => $data['acct_type'],
'total_balance' => 0,
'total_credit' => 0,
'created_by' => null,
'updated_by' => null,
'active' => true,
'parentuid' => null,
'targetuids' => null,
'notes' => null,
'exec_command' => null,
'settings' => null,
'multiple_logins' => false,
'referralcode' => null,
'photourl' => null,
'logs' => null,
'cart' => null,
]);
}
}
}