key) { $attachment->key = (string) Str::uuid(); } }); } protected function casts(): array { return [ 'type' => AttachmentType::class, 'size' => 'integer', ]; } /** * Get the pre-signed temporary S3 URL for this attachment. */ public function getTemporaryUrl(int $expiresInMinutes = 10): string { return \Illuminate\Support\Facades\Storage::disk('s3')->temporaryUrl( $this->path, now()->addMinutes($expiresInMinutes) ); } }