5

I have set up a form with image upload. By default laravel nova is showing a delete button and choose image button.

According to my requirement, my client wants to keep the image as non-editable (hide delete and choose button) in the laravel nova form.

How can I do this? Any ideas?

enter image description here

Prashant Pokhriyal
  • 3,727
  • 4
  • 28
  • 40
Vineeth Vijayan
  • 1,215
  • 1
  • 21
  • 33

3 Answers3

2

There is no option to hide "Choose File" button, only possible to hide delete button in some cases.

But for your case you can just hide whole field from edit form.

File::make('File')->hideWhenUpdating();
Sanasol
  • 892
  • 8
  • 24
2

The delete operation can be disabled from the field with following code:

File::make('File')->deletable(false);
Imran Zahoor
  • 2,521
  • 1
  • 28
  • 38
  • This is exactly what I was looking for. Turns out it is [documented here](https://nova.laravel.com/docs/3.0/resources/file-fields.html#pruning-deletion). – reppair Mar 13 '21 at 23:36
1

Bread and butter of Nova micro-customization, either:

  1. Make custom field based on default Image field.
  2. Use CSS to hide it.
Origami1024
  • 157
  • 3
  • 11