+ return view('attachments.manager-edit-form', [
+ 'attachment' => $attachment,
+ ]);
+ }
+
+ /**
+ * Update the details of an existing file.
+ */
+ public function update(Request $request, string $attachmentId)
+ {
+ /** @var Attachment $attachment */
+ $attachment = Attachment::query()->findOrFail($attachmentId);
+
+ try {
+ $this->validate($request, [
+ 'attachment_edit_name' => ['required', 'string', 'min:1', 'max:255'],
+ 'attachment_edit_url' => ['string', 'min:1', 'max:255', 'safe_url'],
+ ]);
+ } catch (ValidationException $exception) {
+ return response()->view('attachments.manager-edit-form', array_merge($request->only(['attachment_edit_name', 'attachment_edit_url']), [
+ 'attachment' => $attachment,
+ 'errors' => new MessageBag($exception->errors()),
+ ]), 422);