*/ class ReleaseReportFactory extends Factory { /** * The name of the factory's corresponding model. * * @var class-string */ protected $model = ReleaseReport::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $reasons = array_keys(ReleaseReport::REASONS); return [ 'releases_id' => Release::factory(), 'users_id' => User::factory(), 'reason' => fake()->randomElement($reasons), 'description' => fake()->optional()->sentence(), 'status' => 'pending', ]; } /** * Indicate that the report is pending. */ public function pending(): static { return $this->state(fn (array $attributes) => [ 'status' => 'pending', ]); } /** * Indicate that the report has been reviewed. */ public function reviewed(): static { return $this->state(fn (array $attributes) => [ 'status' => 'reviewed', 'reviewed_by' => User::factory(), 'reviewed_at' => now(), ]); } /** * Indicate that the report has been resolved. */ public function resolved(): static { return $this->state(fn (array $attributes) => [ 'status' => 'resolved', 'reviewed_by' => User::factory(), 'reviewed_at' => now(), ]); } /** * Indicate that the report has been dismissed. */ public function dismissed(): static { return $this->state(fn (array $attributes) => [ 'status' => 'dismissed', 'reviewed_by' => User::factory(), 'reviewed_at' => now(), ]); } }