- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env) - 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget) - 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget) - 리소스 한국어화: Product, Material 모델 레이블 추가 - 대시보드: 위젯 등록 및 캐시 최적화 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
173 lines
5.6 KiB
PHP
173 lines
5.6 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Model;
|
|
use App\Models\ModelParameter;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ModelParameter>
|
|
*/
|
|
class ModelParameterFactory extends Factory
|
|
{
|
|
protected $model = ModelParameter::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'tenant_id' => 1,
|
|
'model_id' => Model::factory(),
|
|
'name' => $this->faker->word(),
|
|
'label' => $this->faker->words(2, true),
|
|
'type' => $this->faker->randomElement(['NUMBER', 'SELECT', 'BOOLEAN']),
|
|
'default_value' => '0',
|
|
'validation_rules' => json_encode(['required' => true]),
|
|
'options' => null,
|
|
'sort_order' => $this->faker->numberBetween(1, 10),
|
|
'is_required' => true,
|
|
'is_active' => true,
|
|
'created_by' => 1,
|
|
'updated_by' => 1,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Screen model parameters.
|
|
*/
|
|
public function screenParameters(): static
|
|
{
|
|
return $this->sequence(
|
|
[
|
|
'name' => 'W0',
|
|
'label' => '가로(mm)',
|
|
'type' => 'NUMBER',
|
|
'default_value' => '1000',
|
|
'validation_rules' => json_encode(['required' => true, 'numeric' => true, 'min' => 500, 'max' => 3000]),
|
|
'sort_order' => 1,
|
|
],
|
|
[
|
|
'name' => 'H0',
|
|
'label' => '세로(mm)',
|
|
'type' => 'NUMBER',
|
|
'default_value' => '800',
|
|
'validation_rules' => json_encode(['required' => true, 'numeric' => true, 'min' => 400, 'max' => 2000]),
|
|
'sort_order' => 2,
|
|
],
|
|
[
|
|
'name' => 'screen_type',
|
|
'label' => '스크린 타입',
|
|
'type' => 'SELECT',
|
|
'default_value' => 'SCREEN',
|
|
'validation_rules' => json_encode(['required' => true, 'in' => ['SCREEN', 'SLAT']]),
|
|
'options' => json_encode([
|
|
['value' => 'SCREEN', 'label' => '스크린'],
|
|
['value' => 'SLAT', 'label' => '슬라트']
|
|
]),
|
|
'sort_order' => 3,
|
|
],
|
|
[
|
|
'name' => 'install_type',
|
|
'label' => '설치 방식',
|
|
'type' => 'SELECT',
|
|
'default_value' => 'WALL',
|
|
'validation_rules' => json_encode(['required' => true, 'in' => ['WALL', 'SIDE', 'MIXED']]),
|
|
'options' => json_encode([
|
|
['value' => 'WALL', 'label' => '벽면 설치'],
|
|
['value' => 'SIDE', 'label' => '측면 설치'],
|
|
['value' => 'MIXED', 'label' => '혼합 설치']
|
|
]),
|
|
'sort_order' => 4,
|
|
],
|
|
[
|
|
'name' => 'power_source',
|
|
'label' => '전원',
|
|
'type' => 'SELECT',
|
|
'default_value' => 'AC',
|
|
'validation_rules' => json_encode(['required' => true, 'in' => ['AC', 'DC', 'MANUAL']]),
|
|
'options' => json_encode([
|
|
['value' => 'AC', 'label' => 'AC 전원'],
|
|
['value' => 'DC', 'label' => 'DC 전원'],
|
|
['value' => 'MANUAL', 'label' => '수동']
|
|
]),
|
|
'sort_order' => 5,
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Steel model parameters.
|
|
*/
|
|
public function steelParameters(): static
|
|
{
|
|
return $this->sequence(
|
|
[
|
|
'name' => 'W0',
|
|
'label' => '가로(mm)',
|
|
'type' => 'NUMBER',
|
|
'default_value' => '1200',
|
|
'validation_rules' => json_encode(['required' => true, 'numeric' => true, 'min' => 800, 'max' => 4000]),
|
|
'sort_order' => 1,
|
|
],
|
|
[
|
|
'name' => 'H0',
|
|
'label' => '세로(mm)',
|
|
'type' => 'NUMBER',
|
|
'default_value' => '1000',
|
|
'validation_rules' => json_encode(['required' => true, 'numeric' => true, 'min' => 600, 'max' => 3000]),
|
|
'sort_order' => 2,
|
|
],
|
|
[
|
|
'name' => 'thickness',
|
|
'label' => '두께(mm)',
|
|
'type' => 'NUMBER',
|
|
'default_value' => '50',
|
|
'validation_rules' => json_encode(['required' => true, 'numeric' => true, 'min' => 20, 'max' => 100]),
|
|
'sort_order' => 3,
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Number type parameter.
|
|
*/
|
|
public function number(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'type' => 'NUMBER',
|
|
'validation_rules' => json_encode(['required' => true, 'numeric' => true]),
|
|
'options' => null,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Select type parameter.
|
|
*/
|
|
public function select(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'type' => 'SELECT',
|
|
'options' => json_encode([
|
|
['value' => 'option1', 'label' => 'Option 1'],
|
|
['value' => 'option2', 'label' => 'Option 2'],
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Boolean type parameter.
|
|
*/
|
|
public function boolean(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'type' => 'BOOLEAN',
|
|
'default_value' => 'false',
|
|
'options' => null,
|
|
]);
|
|
}
|
|
} |