241 lines
8.6 KiB
PHP
241 lines
8.6 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\SystemSetting;
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class SystemSettingsSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$settings = [
|
|
// General Settings
|
|
[
|
|
'key' => 'general.system_name',
|
|
'value' => 'Usher Management System',
|
|
'type' => 'string',
|
|
'group' => 'general',
|
|
'description' => 'System name displayed throughout the application'
|
|
],
|
|
[
|
|
'key' => 'general.timezone',
|
|
'value' => 'Asia/Taipei',
|
|
'type' => 'string',
|
|
'group' => 'general',
|
|
'description' => 'System timezone'
|
|
],
|
|
|
|
// Document Features
|
|
[
|
|
'key' => 'features.qr_codes_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'features',
|
|
'description' => 'Enable QR code generation for documents'
|
|
],
|
|
[
|
|
'key' => 'features.tagging_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'features',
|
|
'description' => 'Enable document tagging system'
|
|
],
|
|
[
|
|
'key' => 'features.expiration_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'features',
|
|
'description' => 'Enable document expiration dates and auto-archive'
|
|
],
|
|
[
|
|
'key' => 'features.bulk_import_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'features',
|
|
'description' => 'Enable bulk document import feature'
|
|
],
|
|
[
|
|
'key' => 'features.statistics_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'features',
|
|
'description' => 'Enable document statistics dashboard'
|
|
],
|
|
[
|
|
'key' => 'features.version_history_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'features',
|
|
'description' => 'Enable document version history tracking'
|
|
],
|
|
|
|
// Security & Limits
|
|
[
|
|
'key' => 'security.rate_limit_authenticated',
|
|
'value' => '50',
|
|
'type' => 'integer',
|
|
'group' => 'security',
|
|
'description' => 'Downloads per hour for authenticated users'
|
|
],
|
|
[
|
|
'key' => 'security.rate_limit_guest',
|
|
'value' => '10',
|
|
'type' => 'integer',
|
|
'group' => 'security',
|
|
'description' => 'Downloads per hour for guest users'
|
|
],
|
|
[
|
|
'key' => 'security.max_file_size_mb',
|
|
'value' => '10',
|
|
'type' => 'integer',
|
|
'group' => 'security',
|
|
'description' => 'Maximum file upload size in MB'
|
|
],
|
|
[
|
|
'key' => 'security.allowed_file_types',
|
|
'value' => json_encode(['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'jpg', 'jpeg', 'png']),
|
|
'type' => 'json',
|
|
'group' => 'security',
|
|
'description' => 'Allowed file types for uploads'
|
|
],
|
|
|
|
// Document Settings
|
|
[
|
|
'key' => 'documents.default_access_level',
|
|
'value' => 'members',
|
|
'type' => 'string',
|
|
'group' => 'documents',
|
|
'description' => 'Default access level for new documents (public, members, admin, board)'
|
|
],
|
|
[
|
|
'key' => 'documents.default_expiration_days',
|
|
'value' => '90',
|
|
'type' => 'integer',
|
|
'group' => 'documents',
|
|
'description' => 'Default expiration period in days (0 = no expiration)'
|
|
],
|
|
[
|
|
'key' => 'documents.expiration_warning_days',
|
|
'value' => '30',
|
|
'type' => 'integer',
|
|
'group' => 'documents',
|
|
'description' => 'Days before expiration to show warning'
|
|
],
|
|
[
|
|
'key' => 'documents.auto_archive_enabled',
|
|
'value' => '0',
|
|
'type' => 'boolean',
|
|
'group' => 'documents',
|
|
'description' => 'Automatically archive expired documents'
|
|
],
|
|
[
|
|
'key' => 'documents.max_tags_per_document',
|
|
'value' => '10',
|
|
'type' => 'integer',
|
|
'group' => 'documents',
|
|
'description' => 'Maximum number of tags per document'
|
|
],
|
|
|
|
// Notifications
|
|
[
|
|
'key' => 'notifications.enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'notifications',
|
|
'description' => 'Enable email notifications'
|
|
],
|
|
[
|
|
'key' => 'notifications.expiration_alerts_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'notifications',
|
|
'description' => 'Send email alerts for expiring documents'
|
|
],
|
|
[
|
|
'key' => 'notifications.expiration_recipients',
|
|
'value' => json_encode([]),
|
|
'type' => 'json',
|
|
'group' => 'notifications',
|
|
'description' => 'Email recipients for expiration alerts'
|
|
],
|
|
[
|
|
'key' => 'notifications.archive_notifications_enabled',
|
|
'value' => '1',
|
|
'type' => 'boolean',
|
|
'group' => 'notifications',
|
|
'description' => 'Send notifications when documents are auto-archived'
|
|
],
|
|
[
|
|
'key' => 'notifications.new_document_alerts_enabled',
|
|
'value' => '0',
|
|
'type' => 'boolean',
|
|
'group' => 'notifications',
|
|
'description' => 'Send alerts when new documents are uploaded'
|
|
],
|
|
|
|
// Advanced Settings
|
|
[
|
|
'key' => 'advanced.qr_code_size',
|
|
'value' => '300',
|
|
'type' => 'integer',
|
|
'group' => 'advanced',
|
|
'description' => 'QR code size in pixels'
|
|
],
|
|
[
|
|
'key' => 'advanced.qr_code_format',
|
|
'value' => 'png',
|
|
'type' => 'string',
|
|
'group' => 'advanced',
|
|
'description' => 'QR code format (png or svg)'
|
|
],
|
|
[
|
|
'key' => 'advanced.statistics_time_range',
|
|
'value' => '30',
|
|
'type' => 'integer',
|
|
'group' => 'advanced',
|
|
'description' => 'Default time range for statistics in days'
|
|
],
|
|
[
|
|
'key' => 'advanced.statistics_top_n',
|
|
'value' => '10',
|
|
'type' => 'integer',
|
|
'group' => 'advanced',
|
|
'description' => 'Number of top items to display in statistics'
|
|
],
|
|
[
|
|
'key' => 'advanced.audit_log_retention_days',
|
|
'value' => '365',
|
|
'type' => 'integer',
|
|
'group' => 'advanced',
|
|
'description' => 'How long to retain audit logs in days'
|
|
],
|
|
[
|
|
'key' => 'advanced.max_versions_retain',
|
|
'value' => '0',
|
|
'type' => 'integer',
|
|
'group' => 'advanced',
|
|
'description' => 'Maximum versions to retain per document (0 = unlimited)'
|
|
],
|
|
];
|
|
|
|
foreach ($settings as $settingData) {
|
|
SystemSetting::updateOrCreate(
|
|
['key' => $settingData['key']],
|
|
[
|
|
'value' => $settingData['value'],
|
|
'type' => $settingData['type'],
|
|
'group' => $settingData['group'],
|
|
'description' => $settingData['description'],
|
|
]
|
|
);
|
|
}
|
|
|
|
$this->command->info('System settings seeded successfully (' . count($settings) . ' settings)');
|
|
}
|
|
}
|