parfum/database/factories/PurchaseFactory.php
Yoga Pangestu c4b90acf53 feat: membuat factory seluruh model
- menyesuaikan model jika ada yang salah seperti kurangnya trait SoftDeletes, casting yang salah, relasi yang kurang dan lainnya
- memperbaiki enum di migrasi
2025-12-09 08:25:07 +07:00

25 lines
639 B
PHP

<?php
namespace Database\Factories;
use App\Models\Outlet;
use App\Models\Purchase;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class PurchaseFactory extends Factory
{
protected $model = Purchase::class;
public function definition(): array
{
return [
'outlet_id' => Outlet::factory(),
'invoice_number' => Str::upper($this->faker->bothify('PO-########')),
'purchase_date' => $this->faker->date(),
'total' => $this->faker->numberBetween(50000, 500000),
'note' => $this->faker->optional()->sentence(6),
];
}
}