rezident/yii2-attach-file

This extension for yii2 allows you to attach different uploaded files to models and to represent ones in the different views

Installs: 32

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

0.9.14 2017-04-15 17:03 UTC

This package is auto-updated.

Last update: 2024-09-28 23:47:21 UTC


README

This extension for yii2 allows you to attach different uploaded files to models. The extension is not done! It does not work! Version 0.9 for testing in the real project.

Configuration

To use this extension, simply add the following code in your application configuration:

return [
    //.....
    'modules' => [
        //.....
        'attach_file' => [
            'class' => rezident\attachfile\AttachFileModule::class,
            'originalsPath' => '@app/files/originals',
            'viewsPath' => '@app/files/views',
            'webPath' => '@app/files/views'
        ]
    ]
];

Usage

Adding behavior to the model

To adding behavior to the model you have to

public function behaviors()
{
    return [
        'specified' => [
            'class' => rezident\attachfile\behaviors\AttachFileBehavior::class,
            'modelKey' => 'specified' // If it is not specified, will be used the short name of the model class
        ]
    ];
}