31 lines
868 B
PHP
31 lines
868 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Produk>
|
|
*/
|
|
class ProdukFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$harga_per_gram = $this->faker->numberBetween(80, 120) * 10000;
|
|
$berat = $this->faker->randomFloat(2, 1, 10);
|
|
return [
|
|
'nama' => $this->faker->words(3, true),
|
|
'kategori' => $this->faker->randomElement(['cincin', 'gelang', 'kalung', 'anting']),
|
|
'berat' => $berat,
|
|
'kadar' => $this->faker->numberBetween(10, 24),
|
|
'harga_per_gram' => $harga_per_gram,
|
|
'harga_jual' => $harga_per_gram * $berat,
|
|
];
|
|
}
|
|
}
|