*/ class ShareFactory extends Factory { /** * @return array */ public function definition(): array { return [ 'user_id' => User::factory(), 'token' => Str::random(48), 'recipient_email' => null, 'password' => null, 'expires_at' => now()->addDays(7), 'revoked_at' => null, ]; } public function expired(): static { return $this->state(fn (array $attributes) => [ 'expires_at' => now()->subDay(), ]); } public function revoked(): static { return $this->state(fn (array $attributes) => [ 'revoked_at' => now()->subHour(), ]); } public function passwordProtected(string $password = 'secret-password'): static { return $this->state(fn (array $attributes) => [ 'password' => $password, ]); } }