- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env) - 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget) - 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget) - 리소스 한국어화: Product, Material 모델 레이블 추가 - 대시보드: 위젯 등록 및 캐시 최적화 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
96 lines
2.3 KiB
PHP
96 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Model;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
|
|
*/
|
|
class ModelFactory extends Factory
|
|
{
|
|
protected $model = Model::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'tenant_id' => 1,
|
|
'code' => 'KSS' . $this->faker->numberBetween(10, 99),
|
|
'name' => $this->faker->words(3, true),
|
|
'description' => $this->faker->sentence(),
|
|
'status' => $this->faker->randomElement(['DRAFT', 'RELEASED', 'ARCHIVED']),
|
|
'product_family' => $this->faker->randomElement(['SCREEN', 'STEEL']),
|
|
'is_active' => true,
|
|
'created_by' => 1,
|
|
'updated_by' => 1,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Indicate that the model is active.
|
|
*/
|
|
public function active(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => true,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Indicate that the model is inactive.
|
|
*/
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => false,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Indicate that the model is released.
|
|
*/
|
|
public function released(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'status' => 'RELEASED',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Indicate that the model is draft.
|
|
*/
|
|
public function draft(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'status' => 'DRAFT',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Screen type model.
|
|
*/
|
|
public function screen(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'product_family' => 'SCREEN',
|
|
'code' => 'KSS' . $this->faker->numberBetween(10, 99),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Steel type model.
|
|
*/
|
|
public function steel(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'product_family' => 'STEEL',
|
|
'code' => 'KST' . $this->faker->numberBetween(10, 99),
|
|
]);
|
|
}
|
|
} |