36 lines
848 B
PHP
36 lines
848 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Bucket;
|
|
use App\Models\Draw;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Draw>
|
|
*/
|
|
class DrawFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'bucket_id' => null,
|
|
'amount' => $this->faker->numberBetween(5000, 200000), // $50 to $2000 in cents
|
|
'date' => $this->faker->dateTimeBetween('-6 months', 'now'),
|
|
'description' => $this->faker->sentence(),
|
|
'is_projected' => $this->faker->boolean(),
|
|
];
|
|
}
|
|
|
|
public function bucket(Bucket $bucket): self
|
|
{
|
|
return $this->state(fn () => [
|
|
'bucket_id' => $bucket->id,
|
|
]);
|
|
}
|
|
}
|