yii\db\ActiveRecordInterface::insert PHP Method

insert() public method

Usage example: php $customer = new Customer; $customer->name = $name; $customer->email = $email; $customer->insert();
public insert ( boolean $runValidation = true, array $attributes = null ) : boolean
$runValidation boolean whether to perform validation (calling [[\yii\base\Model::validate()|validate()]]) before saving the record. Defaults to `true`. If the validation fails, the record will not be saved to the database and this method will return `false`.
$attributes array list of attributes that need to be saved. Defaults to `null`, meaning all attributes that are loaded from DB will be saved.
return boolean whether the attributes are valid and the record is inserted successfully.
    public function insert($runValidation = true, $attributes = null);