- menyesuaikan model jika ada yang salah seperti kurangnya trait SoftDeletes, casting yang salah, relasi yang kurang dan lainnya - memperbaiki enum di migrasi
27 lines
696 B
PHP
27 lines
696 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Bottle;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class BottleFactory extends Factory
|
|
{
|
|
protected $model = Bottle::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$costPrice = $this->faker->randomNumber(2);
|
|
|
|
return [
|
|
'name' => $this->faker->word(),
|
|
'slug' => $this->faker->slug(),
|
|
'size' => $this->faker->randomNumber(2),
|
|
'cost_price' => $this->faker->randomNumber(2),
|
|
'sale_price' => $this->faker->randomNumber(2),
|
|
'point_per_pcs' => round($costPrice / 100),
|
|
'description' => $this->faker->sentence(),
|
|
];
|
|
}
|
|
}
|