Reputation: 682
I want to set a default value for a hidden form field in laravel 8.
$form->hidden("product.product_type")->value('1')->setDisplay(false);
Here after saving the form, the value is set as null
and not 1
. What could be the solution?
Upvotes: 0
Views: 2507
Reputation: 450
you have to chain default function
$form->hidden("product.product_type")->value('1')->setDisplay(false)->default('Any Value');
as per documentation here
https://laravel-admin.org/docs/en/model-form-fields#Set%20default%20value
Upvotes: 0