laravel-bakery icon indicating copy to clipboard operation
laravel-bakery copied to clipboard

Make input field explicitly null for input

Open rovansteen opened this issue 5 years ago ā€¢ 1 comments

In 2.0 we check the default attributes for a model to see if we should make the input field nullable or not. So if the field is not nullable itself, setting a default attribute on the model will make the create input for that field nullable. This works fine for simple cases but if the default attribute is dynamic you might want to do this on the observer. I think we should respect this as the constraint that the field is not nullable will probably be on the database in that case. Iā€™m thinking of something like nullableOnCreation() that can be called on a field in the model scheme to define this behavior. Thoughts @erikgaal?

rovansteen avatar Nov 05 '18 08:11 rovansteen

Sounds reasonable!

erikgaal avatar Nov 05 '18 11:11 erikgaal