Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Nova - How to remove delete button from file field in form

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

like image 756
Vineeth Vijayan Avatar asked Mar 07 '19 05:03

Vineeth Vijayan


2 Answers

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();
like image 81
Sanasol Avatar answered Oct 07 '22 12:10

Sanasol


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

File::make('File')->deletable(false);
like image 44
Imran Zahoor Avatar answered Oct 07 '22 14:10

Imran Zahoor