Files
star-erp/database/seeders/SystemSettingSeeder.php
sky121113 07b7d9b327
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 56s
[FEAT] 實作公共事業費逾期提醒、租戶自訂通知設定及發送測試信功能
2026-03-05 16:01:00 +08:00

91 lines
3.0 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class SystemSettingSeeder extends Seeder
{
public function run(): void
{
$settings = [
// 💰 財務設定
[
'group' => 'finance',
'key' => 'finance.ap_payment_days',
'value' => '30',
'type' => 'integer',
'description' => '應付帳款預設付款天數',
],
// 📦 庫存管理
[
'group' => 'inventory',
'key' => 'inventory.expiry_warning_days',
'value' => '30',
'type' => 'integer',
'description' => '商品到期預警天數',
],
// 📊 周轉率分析
[
'group' => 'turnover',
'key' => 'turnover.analysis_period_days',
'value' => '30',
'type' => 'integer',
'description' => '周轉率分析:銷售統計期間(天)',
],
[
'group' => 'turnover',
'key' => 'turnover.dead_stock_days',
'value' => '90',
'type' => 'integer',
'description' => '周轉率分析:滯銷判定天數',
],
[
'group' => 'turnover',
'key' => 'turnover.slow_moving_days',
'value' => '60',
'type' => 'integer',
'description' => '周轉率分析:週轉慢判定天數',
],
// 🖥️ 顯示設定
[
'group' => 'display',
'key' => 'display.per_page',
'value' => '10',
'type' => 'integer',
'description' => '每頁預設筆數',
],
// 📧 通知設定
[
'group' => 'notification',
'key' => 'notification.utility_fee_sender_email',
'value' => 'sky121113@gmail.com',
'type' => 'string',
'description' => '發送公共事業通知的 Gmail 帳號',
],
[
'group' => 'notification',
'key' => 'notification.utility_fee_sender_password',
'value' => 'qjxcedzcrjoyioxu',
'type' => 'string',
'description' => '發送公共事業通知的 Gmail 應用程式密碼',
],
[
'group' => 'notification',
'key' => 'notification.utility_fee_recipient_emails',
'value' => 'sky121113@gmail.com',
'type' => 'string',
'description' => '接收通知的 Email 清單 (多筆請用逗號分隔)',
],
];
foreach ($settings as $setting) {
\App\Modules\Core\Models\SystemSetting::updateOrCreate(
['key' => $setting['key']],
$setting
);
}
}
}