t-kanstantsin/yii2-author-behavior

Author behavior for Yii 2 framework.

dev-master / 1.0.x-dev 2015-12-23 23:59 UTC

This package is not auto-updated.

Last update: 2024-11-09 20:22:50 UTC


README

Behavior represents additional functionality similar to yii\db\TimestampBehavior but automatically fills the specified attributes with the current user id or value defined in value field.

Install

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require --prefer-dist t-kanstantsin/yii2-author-behavior "*"

or add

"t-kanstantsin/yii2-author-behavior": "*"

to the require section of your composer.json file.

Usage

Example behavior configuration:

    // in `behaviors` method
    [
        'class' => tkanstantsin\yii2\behaviors\AuthorBehavior::class, 
        'createdByAttribute' => 'created_by_id',
        'updatedByAttribute' => 'updated_by_id',
    ],

Credits

License

The BSD License (BSD). Please see License File for more information.