*/ class ConversationFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Conversation::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'type' => ConversationType::Private, 'disappearing_started_at' => null, 'disappearing_duration' => null, ]; } /** * Indicate that the conversation is a group. */ public function group(): static { return $this->state(fn (array $attributes) => [ 'type' => ConversationType::Group, ]); } /** * Indicate that the conversation has disappearing messages enabled. */ public function withDisappearing(int $duration = 86400): static { return $this->state(fn (array $attributes) => [ 'disappearing_started_at' => now(), 'disappearing_duration' => $duration, ]); } }