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,29 @@
<?php
namespace Database\Factories;
use App\Models\Contract;
use App\Models\Product;
use Illuminate\Database\Eloquent\Factories\Factory;
class ContractFactory extends Factory
{
protected $model = Contract::class;
public function definition(): array
{
return [
'product_id' => Product::factory(),
'contract_number' => 'HDMB-' . $this->faker->unique()->numberBetween(10000, 99999),
'contract_type' => 'HĐMB',
'signing_date' => $this->faker->date(),
'status' => 'Đang hiệu lực',
'total_value' => fn (array $attributes) => Product::find($attributes['product_id'])->total_price,
'paid_amount' => function (array $attributes) {
$total = Product::find($attributes['product_id'])->total_price;
return $this->faker->randomFloat(2, 0, $total);
},
'transfer_order' => 0,
];
}
}