Files
BarangaySystem/database/seeders/SystemSettingSeeder.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

184 lines
7.7 KiB
PHP

<?php
use App\Models\SystemSetting;
class SystemSettingSeeder extends \Hyperf\Database\Seeders\Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$settings = [
// General Settings
[
'key' => 'app_name',
'value' => 'Barangay System',
'type' => 'text',
'group' => 'general',
'label' => 'Application Name',
'description' => 'The public name of the platform.'
],
[
'key' => 'app_description',
'value' => 'Barangay Management & Governance Platform',
'type' => 'text',
'group' => 'general',
'label' => 'Application Description',
'description' => 'Brief description of the application.'
],
[
'key' => 'app_tagline',
'value' => 'Serving our community, one document at a time.',
'type' => 'text',
'group' => 'general',
'label' => 'Tagline',
'description' => 'Application tagline or slogan.'
],
// Branding Settings
[
'key' => 'app_logo',
'value' => null,
'type' => 'image',
'group' => 'branding',
'label' => 'Application Logo',
'description' => 'Upload a logo to replace the default icon.'
],
[
'key' => 'primary_color',
'value' => '#0d6efd',
'type' => 'text',
'group' => 'branding',
'label' => 'Primary Color',
'description' => 'Global primary accent color for the theme. Auto-derived from the uploaded logo.'
],
[
'key' => 'accent_color',
'value' => '#533dea',
'type' => 'text',
'group' => 'branding',
'label' => 'Accent Color',
'description' => 'Secondary accent color. Auto-derived from the uploaded logo.'
],
[
'key' => 'background_tint',
'value' => '#f5f4ff',
'type' => 'text',
'group' => 'branding',
'label' => 'Background Tint',
'description' => 'Soft background tint derived from the logo for hero/home backgrounds.'
],
// Advanced Settings
[
'key' => 'footer_text',
'value' => '&copy; 2026 Barangay System. All rights reserved.',
'type' => 'text',
'group' => 'advanced',
'label' => 'Footer Text',
'description' => 'Text displayed in the application footer.'
],
[
'key' => 'maintenance_mode',
'value' => 'false',
'type' => 'boolean',
'group' => 'advanced',
'label' => 'Maintenance Mode',
'description' => 'Enable or disable maintenance mode globally.'
],
[
'key' => 'priority_sectors',
'value' => json_encode(['INDIGENT', "PWD's", 'SENIOR', 'Solo Parents', "OFW's", 'Indigenious Youth', 'Farmers', 'FISHERMEN', 'Calamity', 'Retrenchment', 'Former Rebels', 'Former Violent Extremist Groups']),
'type' => 'json',
'group' => 'general',
'label' => 'Priority Sectors',
'description' => 'List of sectors eligible for priority programs and assistance.'
],
[
'key' => 'group_types',
'value' => json_encode(['COOPERATIVE', 'ASSOCIATION', 'CORPORATION', 'NGO', 'OTHER']),
'type' => 'json',
'group' => 'general',
'label' => 'Group Types',
'description' => 'Types of organizations or associations members can belong to.'
],
[
'key' => 'default_address_fields',
'value' => json_encode(['house_no', 'street', 'barangay', 'city', 'province', 'region', 'country', 'zipcode']),
'type' => 'json',
'group' => 'general',
'label' => 'Default Address Fields',
'description' => 'Standard fields for address objects in the system.'
],
[
'key' => 'app_mode',
'value' => 'barangay',
'type' => 'select',
'options' => json_encode(['barangay']),
'group' => 'general',
'label' => 'Application Mode',
'description' => 'Defines the operational mode of the platform, which affects available features and terminology.'
],
[
'key' => 'main_organization',
'value' => null,
'type' => 'organization',
'group' => 'general',
'label' => 'Main Cooperative / Organization',
'description' => 'Designates the primary cooperative or organization for the platform. Used mostly when Application Mode is set to cooperative.'
],
[
'key' => 'chapter_positions',
'value' => json_encode(['Punong Barangay', 'Kagawad', 'Secretary', 'Treasurer', 'SK Chairperson', 'SK Councilor', 'Tanod', 'BHW', 'Daycare Worker', 'Staff', 'Member']),
'type' => 'json',
'group' => 'general',
'label' => 'Chapter Positions',
'description' => 'Available position titles that can be assigned to members within regional chapters.'
],
[
'key' => 'accounting_theme',
'value' => 'blank',
'type' => 'select',
'options' => json_encode(['blank', 'general_business', 'retail_pos', 'service_business', 'agri_coop']),
'group' => 'general',
'label' => 'Accounting Theme',
'description' => 'Starter Chart of Accounts preset for this deployment. Defined in config/accounting/themes.php. Switching only changes the theme tag used for branching and drift detection — it does not migrate existing accounts.'
],
[
'key' => 'top_up_enabled',
'value' => 'false',
'type' => 'boolean',
'group' => 'advanced',
'label' => 'Top Up Enabled',
'description' => 'Enable or disable the credit top-up feature globally.'
],
[
'key' => 'default_org_type',
'value' => 'COOPERATIVE',
'type' => 'select',
'options' => json_encode(['COOPERATIVE', 'NGO', 'CORPORATION']),
'group' => 'general',
'label' => 'Default Organization Type',
'description' => 'Pre-selected type when creating a new organization. Options: Cooperative, NGO, Corporation/Company.',
],
];
foreach ($settings as $setting) {
$exists = SystemSetting::where('key', $setting['key'])->first();
if ($exists) {
// Preserve the operator's chosen value; only refresh schema/metadata
// (type, options, group, label, description) so re-seeding never
// clobbers configured settings.
$update = $setting;
unset($update['value']);
$exists->update($update);
} else {
SystemSetting::create($setting);
}
}
SystemSetting::clearCache();
}
}