bedezign\yii2\audit\models\AuditEntry::record PHP Method

record() public method

Records the current application state into the instance.
public record ( )
    public function record()
    {
        $app = Yii::$app;
        $request = $app->request;
        $this->route = $app->requestedAction ? $app->requestedAction->uniqueId : null;
        if ($request instanceof \yii\web\Request) {
            $user = $app->user;
            $this->user_id = $user->isGuest ? 0 : $user->id;
            $this->ip = $request->userIP;
            $this->ajax = $request->isAjax;
            $this->request_method = $request->method;
        } else {
            if ($request instanceof \yii\console\Request) {
                $this->request_method = 'CLI';
            }
        }
        $this->save(false);
    }