feat : 테넌트 부트스트랩 오케스트레이션
Notion : https://www.notion.so/hamss/2579c8d34ba080d586b6faaae249f476?source=copy_link
This commit is contained in:
28
app/Services/TenantBootstrap/Steps/SettingsStep.php
Normal file
28
app/Services/TenantBootstrap/Steps/SettingsStep.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\TenantBootstrap\Steps;
|
||||
|
||||
use App\Services\TenantBootstrap\Contracts\TenantBootstrapStep;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SettingsStep implements TenantBootstrapStep
|
||||
{
|
||||
public function key(): string { return 'settings_seed'; }
|
||||
|
||||
public function run(int $tenantId): void
|
||||
{
|
||||
if (!DB::getSchemaBuilder()->hasTable('settings')) return;
|
||||
|
||||
$pairs = [
|
||||
['general.company_name', '회사명 미설정'],
|
||||
['ui.theme', 'light'],
|
||||
['inventory.auto_reserve', '0'],
|
||||
];
|
||||
foreach ($pairs as [$key,$val]) {
|
||||
DB::table('settings')->updateOrInsert(
|
||||
['tenant_id'=>$tenantId, 'key'=>$key],
|
||||
['value'=>$val, 'updated_at'=>now(), 'created_at'=>now()]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user