32 lines
834 B
PHP
32 lines
834 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Ledger;
|
|
use App\Models\Mutation;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Mutation>
|
|
*/
|
|
class MutationFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'ledger_id' => Ledger::factory(),
|
|
'user_id' => User::factory(),
|
|
'type' => $this->faker->randomElement(['addition', 'subtraction', 'reward', 'penalty']),
|
|
'amount' => $this->faker->randomElement([5, 10, 15, -5, -10, -25]),
|
|
'description' => $this->faker->sentence(),
|
|
'status' => $this->faker->randomElement(['approved', 'pending', 'rejected']),
|
|
];
|
|
}
|
|
}
|