Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pmichael16's avatar

Modify Trix Attachment File Path in Nova using Slug

Hi,

I'm currently using the Trix Field in Nova and it works perfectly with adding attachments as shown: Trix::make('Description') ->withFiles('s3', 'users/attachments/' . Carbon::now()->format('FY')) ->rules('required') ->hideFromIndex(), The above code saves all attached files in the users/attachments/MonthYear folder of my S3 bucket however for better file structure, I'd like to dynamically modify this to save in the users/user-slug/attachments folder instead.

Is there a way I can access the user-slug value and place it in the path variable? I've done something similar using the store method for the Image field but it doesn't seem to apply with Trix.

Thanks in advance for your time!

0 likes
1 reply

Please or to participate in this conversation.