Архив метки: eloquent

Eloquent model default values

Tryin’ to find a way to set default model values in Eloquent model (speaking about Laravel ORM) I was surprised that there’s no any mention about it in official docs. So thanks to fellas from StackOverflow such a workaround was found:

This example shows you how to set default value to ‘foo’ model property (model field, attribute, etc) if you’re creating a new FooModel record. Читать далее