feat: 統一各模組分頁組件佈局並新增系統設定功能相關檔案
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m5s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m5s
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('group')->index()->comment('設定分組');
|
||||
$table->string('key')->unique()->comment('設定鍵名');
|
||||
$table->text('value')->nullable()->comment('設定值');
|
||||
$table->string('type')->default('string')->comment('資料型別');
|
||||
$table->string('description')->nullable()->comment('功能說明');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_settings');
|
||||
}
|
||||
};
|
||||
@@ -124,6 +124,10 @@ class PermissionSeeder extends Seeder
|
||||
// 系統日誌
|
||||
'system.view_logs' => '檢視日誌',
|
||||
|
||||
// 系統設定
|
||||
'system.settings.view' => '檢視設定',
|
||||
'system.settings.edit' => '編輯設定',
|
||||
|
||||
// 公共事業費管理
|
||||
'utility_fees.view' => '檢視',
|
||||
'utility_fees.create' => '建立',
|
||||
|
||||
68
database/seeders/SystemSettingSeeder.php
Normal file
68
database/seeders/SystemSettingSeeder.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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' => '每頁預設筆數',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
\App\Modules\Core\Models\SystemSetting::updateOrCreate(
|
||||
['key' => $setting['key']],
|
||||
$setting
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user