Yii2: Setting Default Values For All Attributes Of A Model

[Solved] Yii2: Setting Default Values For All Attributes Of A Model | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : Yii2: Setting default values for all attributes of a model

Answered by : wicked-worm-8hcrxvq84oh5

$customer = new Customer();
$customer->loadDefaultValues();
// $customer->xyz will be assigned the default value declared when defining the "xyz" column

Source : https://www.yiiframework.com/doc/guide/2.0/en/db-active-record | Last Update : Wed, 28 Apr 21

Answers related to Yii2: Setting default values for all attributes of a model

Code Explorer Popular Question For Php Frameworks Yii