Open blpraveen opened 8 months ago
what are u doing for this issue?
Just use the required options in the bread, unless that's the actual bug here? No asterisk's are displayed, but validation should fail and then present a warning, a little late, sure. { "validation": { "rule": "required" } }
I wouldn't consider this a bug. There's no need to assume they are required fields. Probably, sure, but not required. You have the ability to overload the BREAD resources and specify a controller to control these aspects for the needs of your application.
Make a /resources/vendor/voyager/[model]/ folder , so /resources/vendor/voyager/users/
Copy the /vendor/tcg/voyager/resources/views/users/edit-add.blade.php to /resources/vendor/voyager/users/edit-add.blade.php
^ make your changes to that blade, maybe make a list of "required" options in your User model like fillable. Or dive into where the validations are stored. Then in your edited blade, as you loop through the model columns your can check if it's in the models required array and add your asterisk's and any other logic.
Then if you need more can extend the VoyagerBaseController, or make your own, and point your bread at that controller instead of the default.
Hi @Emerica Is it possible to use/override one edit-add.blade.php to all models?
@blpraveen Just wakin' up, so the brainpan might not be top notch, but you could try sym-linking?
Revisiting this hacky solution, you could also copy the VoyagerBaseController into your project and then change how it operates, point at a single blade instead of it being dynamic. With the dev cycle now being kinda dead you at least don't need to worry about it changing as much.
https://github.com/thedevdojo/voyager/blob/7866a2d287c72b2682322d84f691974eb68c9331/src/Http/Controllers/VoyagerBaseController.php#L320 https://github.com/thedevdojo/voyager/blob/7866a2d287c72b2682322d84f691974eb68c9331/src/Http/Controllers/VoyagerBaseController.php#L322
Laravel version
8
PHP version
7.4
Voyager version
1.4.3
Database
Mysql 8
Description
In admin Model required form fields should have astrick (*) Mark. Currently User as know information of which fields are mandatory
Steps to reproduce
In User Create fields dont have astrick (*)
Expected behavior
Should have astrick before Field Label
Screenshots
Additional context
No response