Closed christie-hill-za closed 2 years ago
Use a BREAD accessor (for add in your case) to provide a default value. I think putting a static path into the json options isn't really a good idea. With the accessor you are able to do some more dynamic things.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Laravel version
9.0
PHP version
8.0.2
Voyager version
1.5.2
Description of problem
I would like to specify a default value for an instance of the media picker formfield in one of my models and there currently doesn't seem to be an option for it according to the documentation page.
Some other fields have this option available in their BREAD configuration.
Proposed solution
Add another customisation option to the BREAD settings for the Media Picker field that allows a default value to be specified.
{ "default": "path/to/default.jpg" }
Alternatives considered
Don't set the field to required in the database settings and allow NULL. I will try to work on a PR for this in my spare time.
Additional context
This setting does not seem to work with the Media Picker field.