feat: DB 연결 오버라이딩 및 대시보드 통계 위젯 추가
- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env) - 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget) - 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget) - 리소스 한국어화: Product, Material 모델 레이블 추가 - 대시보드: 위젯 등록 및 캐시 최적화 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
151
database/factories/ModelFormulaFactory.php
Normal file
151
database/factories/ModelFormulaFactory.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ModelFormula;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ModelFormula>
|
||||
*/
|
||||
class ModelFormulaFactory extends Factory
|
||||
{
|
||||
protected $model = ModelFormula::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(),
|
||||
'expression' => 'W0 * H0',
|
||||
'description' => $this->faker->sentence(),
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => $this->faker->numberBetween(1, 10),
|
||||
'is_active' => true,
|
||||
'created_by' => 1,
|
||||
'updated_by' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Screen model formulas.
|
||||
*/
|
||||
public function screenFormulas(): static
|
||||
{
|
||||
return $this->sequence(
|
||||
[
|
||||
'name' => 'W1',
|
||||
'expression' => 'W0 + 120',
|
||||
'description' => '최종 가로 크기',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'H1',
|
||||
'expression' => 'H0 + 100',
|
||||
'description' => '최종 세로 크기',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 2,
|
||||
],
|
||||
[
|
||||
'name' => 'area',
|
||||
'expression' => 'W1 * H1 / 1000000',
|
||||
'description' => '면적 (㎡)',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 3,
|
||||
],
|
||||
[
|
||||
'name' => 'weight',
|
||||
'expression' => 'area * 15',
|
||||
'description' => '중량 (kg)',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 4,
|
||||
],
|
||||
[
|
||||
'name' => 'motor',
|
||||
'expression' => 'IF(area <= 3, "0.5HP", IF(area <= 6, "1HP", "2HP"))',
|
||||
'description' => '모터 용량',
|
||||
'return_type' => 'STRING',
|
||||
'sort_order' => 5,
|
||||
],
|
||||
[
|
||||
'name' => 'bracket',
|
||||
'expression' => 'CEIL(W1 / 600)',
|
||||
'description' => '브라켓 개수',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 6,
|
||||
],
|
||||
[
|
||||
'name' => 'guide',
|
||||
'expression' => 'H1 / 1000 * 2',
|
||||
'description' => '가이드 길이 (m)',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 7,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Steel model formulas.
|
||||
*/
|
||||
public function steelFormulas(): static
|
||||
{
|
||||
return $this->sequence(
|
||||
[
|
||||
'name' => 'W1',
|
||||
'expression' => 'W0 + 50',
|
||||
'description' => '최종 가로 크기',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'H1',
|
||||
'expression' => 'H0 + 50',
|
||||
'description' => '최종 세로 크기',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 2,
|
||||
],
|
||||
[
|
||||
'name' => 'area',
|
||||
'expression' => 'W1 * H1 / 1000000',
|
||||
'description' => '면적 (㎡)',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 3,
|
||||
],
|
||||
[
|
||||
'name' => 'weight',
|
||||
'expression' => 'area * thickness * 7.85',
|
||||
'description' => '중량 (kg)',
|
||||
'return_type' => 'NUMBER',
|
||||
'sort_order' => 4,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Number type formula.
|
||||
*/
|
||||
public function number(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'return_type' => 'NUMBER',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* String type formula.
|
||||
*/
|
||||
public function string(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'return_type' => 'STRING',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user