Init: Hoan thanh kien truc V3 va Filament UI

This commit is contained in:
2026-04-18 02:07:30 +00:00
commit 761b34916b
141 changed files with 15917 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Database\Factories;
use App\Models\Product;
use App\Models\Project;
use Illuminate\Database\Eloquent\Factories\Factory;
class ProductFactory extends Factory
{
protected $model = Product::class;
public function definition(): array
{
$type = $this->faker->randomElement(['LAND', 'APARTMENT']);
$area = $this->faker->randomFloat(2, 50, 200);
$pricePerUnit = $this->faker->numberBetween(20, 100) * 1000000; // 20M to 100M VND
$customData = match ($type) {
'LAND' => [
'frontage' => $this->faker->numberBetween(1, 3),
'road_width' => $this->faker->numberBetween(6, 30),
],
'APARTMENT' => [
'block' => $this->faker->randomElement(['A', 'B', 'C']),
'floor' => $this->faker->numberBetween(2, 30),
'view' => $this->faker->randomElement(['Hồ bơi', 'Công viên', 'Thành phố']),
],
};
return [
'project_id' => Project::factory(),
'product_type' => $type,
'code' => 'STH-' . $this->faker->unique()->numberBetween(1000, 9999),
'area' => $area,
'price_per_unit' => $pricePerUnit,
'total_price' => $area * $pricePerUnit,
'custom_data' => $customData,
'status' => 'Đang mở bán',
'red_book_status' => 'Chưa có dữ liệu',
];
}
}