2025-08-22 15:57:44 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Services\TenantBootstrap\Steps;
|
|
|
|
|
|
|
|
|
|
use App\Services\TenantBootstrap\Contracts\TenantBootstrapStep;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
|
|
class CapabilityProfilesStep implements TenantBootstrapStep
|
|
|
|
|
{
|
2025-11-06 17:45:49 +09:00
|
|
|
public function key(): string
|
|
|
|
|
{
|
|
|
|
|
return 'capability_profiles';
|
|
|
|
|
}
|
2025-08-22 15:57:44 +09:00
|
|
|
|
|
|
|
|
public function run(int $tenantId): void
|
|
|
|
|
{
|
|
|
|
|
$profiles = [
|
2025-11-06 17:45:49 +09:00
|
|
|
['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]],
|
2025-08-22 15:57:44 +09:00
|
|
|
];
|
|
|
|
|
foreach ($profiles as [$code,$name,$attrs]) {
|
|
|
|
|
DB::table('common_codes')->updateOrInsert(
|
2025-11-06 17:45:49 +09:00
|
|
|
['tenant_id' => $tenantId, 'code_group' => 'capability_profile', 'code' => $code],
|
2025-08-22 15:57:44 +09:00
|
|
|
[
|
2025-11-06 17:45:49 +09:00
|
|
|
'name' => $name,
|
|
|
|
|
'attributes' => json_encode($attrs, JSON_UNESCAPED_UNICODE),
|
|
|
|
|
'is_active' => 1, 'sort_order' => 0,
|
|
|
|
|
'description' => '기본 프로필',
|
2025-08-22 15:57:44 +09:00
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|