Files
sam-api/app/Services/TenantBootstrap/Steps/CapabilityProfilesStep.php

36 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace App\Services\TenantBootstrap\Steps;
use App\Services\TenantBootstrap\Contracts\TenantBootstrapStep;
use Illuminate\Support\Facades\DB;
class CapabilityProfilesStep implements TenantBootstrapStep
{
public function key(): string
{
return 'capability_profiles';
}
public function run(int $tenantId): void
{
$profiles = [
['FINISHED_GOOD', '완제품', ['is_sellable' => 1, 'is_purchasable' => 0, 'is_producible' => 1, 'is_stock_managed' => 1]],
['SUB_ASSEMBLY', '서브어셈블리', ['is_sellable' => 0, 'is_purchasable' => 0, 'is_producible' => 1, 'is_stock_managed' => 1]],
['PURCHASED_PART', '구매부품', ['is_sellable' => 0, 'is_purchasable' => 1, 'is_producible' => 0, 'is_stock_managed' => 1]],
['PHANTOM', '팬텀(가상)', ['is_sellable' => 0, 'is_purchasable' => 0, 'is_producible' => 1, 'is_stock_managed' => 0]],
];
foreach ($profiles as [$code,$name,$attrs]) {
DB::table('common_codes')->updateOrInsert(
['tenant_id' => $tenantId, 'code_group' => 'capability_profile', 'code' => $code],
[
'name' => $name,
'attributes' => json_encode($attrs, JSON_UNESCAPED_UNICODE),
'is_active' => 1, 'sort_order' => 0,
'description' => '기본 프로필',
]
);
}
}
}