fix : Category, Product 관련 테이블 정리 (Models, DB, seeder)
This commit is contained in:
75
database/seeders/CapabilityProfileSeeder.php
Normal file
75
database/seeders/CapabilityProfileSeeder.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CapabilityProfileSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$tenantId = null; // null = 공통, 필요시 테넌트별로도 생성 가능
|
||||
$group = 'capability_profile';
|
||||
|
||||
$profiles = [
|
||||
[
|
||||
'code' => 'FINISHED_GOOD',
|
||||
'name' => '완제품',
|
||||
'attributes' => [
|
||||
'is_sellable' => 1,
|
||||
'is_purchasable' => 0,
|
||||
'is_producible' => 1,
|
||||
'is_stock_managed' => 1,
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'SUB_ASSEMBLY',
|
||||
'name' => '서브어셈블리',
|
||||
'attributes' => [
|
||||
'is_sellable' => 0,
|
||||
'is_purchasable' => 0,
|
||||
'is_producible' => 1,
|
||||
'is_stock_managed' => 1,
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'PURCHASED_PART',
|
||||
'name' => '구매부품',
|
||||
'attributes' => [
|
||||
'is_sellable' => 0,
|
||||
'is_purchasable' => 1,
|
||||
'is_producible' => 0,
|
||||
'is_stock_managed' => 1,
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'PHANTOM',
|
||||
'name' => '팬텀(가상)',
|
||||
'attributes' => [
|
||||
'is_sellable' => 0,
|
||||
'is_purchasable' => 0,
|
||||
'is_producible' => 1,
|
||||
'is_stock_managed' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($profiles as $p) {
|
||||
DB::table('common_codes')->updateOrInsert(
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'code_group' => $group,
|
||||
'code' => $p['code'],
|
||||
],
|
||||
[
|
||||
'name' => $p['name'],
|
||||
'attributes' => json_encode($p['attributes']),
|
||||
'description' => '기본 프로필',
|
||||
'is_active' => 1,
|
||||
'sort_order' => 0,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user