- menyesuaikan model jika ada yang salah seperti kurangnya trait SoftDeletes, casting yang salah, relasi yang kurang dan lainnya - memperbaiki enum di migrasi
25 lines
639 B
PHP
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),
|
|
];
|
|
}
|
|
}
|