aligajani
5 months ago
491
1
Nova

How can I instruct Nova to store the fullUrl of the S3 uploads?

Posted 5 months ago by aligajani
  1. This doesn't work because the attachment isn't a valid key.
  2. This is repetitive and I am sure there can be a global way.
->disk('s3')
                ->storeAs(function (Request $request) {
                    $name = sha1($request->attachment->getClientOriginalName()) . '-'
                        . now()->format('D_Y-m-d-T_H-m-s') . '-'
                        . ($request->attachment->getClientOriginalName());
                    $awsBucket = env("AWS_BUCKET");
                    $awsRegion = env("AWS_DEFAULT_REGION");

                    return "https://{$awsBucket}.s3.{$awsRegion}.amazonaws.com/{$name}";
                }),

Please sign in or create an account to participate in this conversation.