/** * @ignore * * @param array $opts * * @return AutoField */ public static function AutoField($opts = []) { return AutoField::createObject($opts); }
/** * @param Model $model * * @since 1.1.0 * * @author Eddilbert Macharia (http://eddmash.com) <*****@*****.**> */ public function prepare($model) { if (empty($this->primaryKey)) { if (!empty($this->parents)) { $field = current(array_values($this->parents)); $field->primaryKey = true; $this->setupPrimaryKey($field); } else { $field = AutoField::createObject(['verboseName' => 'ID', 'primaryKey' => true, 'autoCreated' => true]); $model->addToClass('id', $field); } } }