Declaration of bedezign\\yii2\\audit\\components\\

2019-06-11 12:59发布

问题:

I am using yii2-audit extension for audit logs, I followed all steps of installation and also migrate all tables. But when I update table value then it will return error like Audit module cannot be loaded.

I have place behaviors() in my model.

My Model

<?php
namespace frontend\models;
use yii\base\Model;
use yii\web\UploadedFile;
use bedezign\yii2\models\AuditTrail;
use bedezign\yii2\audit\models\AuditEntry;
use bedezign\yii2\Audit;
class StudentForm extends \yii\db\ActiveRecord
{

    public function behaviors()
    {
        return [
            'AuditTrailBehavior' => [
                'class' => 'bedezign\yii2\audit\AuditTrailBehavior',
                // Array with fields to save. You don't need to configure both `allowed` and `ignored`
                'allowed' => ['firstname','lastname','email','phone'],
                'active' => true,
                // Date format to use in stamp - set to "Y-m-d H:i:s" for datetime or "U" for timestamp
                'dateFormat' => 'Y-m-d H:i:s',
            ]
        ];
    }

My question is

  1. Why I am getting error like Audit module cannot be loaded ?

  2. Why any error or other logs are not storing into audit tables ?

I have added audit in main.php

'modules' => [
        'audit' => 'bedezign\yii2\audit\Audit',
    ],    

After added I am getting error like below image.