hendrignwn/yii2-log

Activity Logs function model

Installs: 136

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2016-11-02 06:39 UTC

This package is not auto-updated.

Last update: 2025-01-04 20:47:13 UTC


README

The main function is to record the changes in the model.

  • There is a feature to allow users see these logs.

Installation

The preferred way to install this extension is through composer. After, either run

php composer.phar require --prefer-dist hendrignwn/yii2-log

or add

"hendrignwn/yii2-log": "dev-master"

to the require section of your composer.json file. run migration for database

yii migrate --migrationPath=@hendrignwn/log/migrations

add in modules section of main config

    'modules' => [
        ...
	   'log-module' => [
            'class' => hendrignwn\log\LogModule::className(),
        ],
        ...
    ]

add in the Model that you want to Log into function behavior()

    public function behaviors() {
 		return [
            ...
 			'hendrignwn\log\behaviors\LogBehavior',
 			...
 		];
 	}

or add in the parent Models if it is to set up the model that you want in the Log but this code 'hendrignwn\log\behaviors\LogBehavior' not be reused.

    public function behaviors() {
 		return [
            ....
 			'hendrignwn\log\behaviors\LoggableBehavior',
 			....
 		];
    }

Usage

Once the extension is installed, check the url: [your application base url]/index.php/log-module

Note: This Log only be accessed if the user has been logged. Otherwise it will be a error 403 permission access not allowed.

License

Hendri Gunawan