public function saveHistory($model, $historyField)
    {
        if (isset($model->{$historyField})) {
            $url_components = explode("\\", get_class($model));
            $url_components[2] = trim(preg_replace("([A-Z])", " $0", $url_components[2]), " ");

            $history = new History;
            $history->name = $model->{$historyField};
            $history->type = $url_components[2];
            $history->url = Url::toRoute(['update', 'id' => $model->id]);
            $history->save();
        }
    }
public function saveHistory($model, $historyField)
    {
        if (isset($model->{$historyField})) {
            $url_components = explode("\\", get_class($model));
            $url_components[2] = trim(preg_replace("([A-Z])", " $0", $url_components[2]), " ");

            $history = new History;
            $history->name = $model->{$historyField};
            $history->type = $url_components[2];
            $history->url = Url::toRoute(['update', 'id' => $model->id]);
            $history->save();
        }
    }
public function saveHistory ( $ model , $ historyField ) { if ( isset ( $ model -> { $ historyField } ) ) { $ url_components = explode ( "\\" , get_class ( $ model ) ) ; $ url_components [ 2 ] = trim ( preg_replace ( "([A-Z])" , " $0" , $ url_components [ 2 ] ) , " " ) ; $ history = new History ; $ history -> name = $ model -> { $ historyField } ; $ history -> type = $ url_components [ 2 ] ; $ history -> url = Url :: toRoute ( [ 'update' , 'id' => $ model -> id ] ) ; $ history -> save ( ) ; } }
Saves the history for the model
@param \yii\db\ActiveRecord $model
@param string $historyField
@return null
Saves the history for the model