Skip to content

Commit 209dd79

Browse files
committed
Update README.md
1 parent ceb15e9 commit 209dd79

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ Upload behavior for Yii 2
33

44
This behavior automatically uploads file and fills the specified attribute with a value of the name of the uploaded file.
55

6-
[![Latest Stable Version](https://poser.pugx.org/mongosoft/yii2-upload-behavior/v/stable.png)](https://packagist.org/packages/mongosoft/yii2-upload-behavior)
7-
[![Total Downloads](https://poser.pugx.org/mongosoft/yii2-upload-behavior/downloads.png)](https://packagist.org/packages/mongosoft/yii2-upload-behavior)
6+
[![Latest Version](https://img.shields.io/packagist/v/mongosoft/yii2-upload-behavior.svg?style=flat-square)](https://packagist.org/packages/mongosoft/yii2-upload-behavior)
7+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
8+
[![Build Status](https://img.shields.io/travis/mongosoft/yii2-upload-behavior/master.svg?style=flat-square)](https://travis-ci.org/mongosoft/yii2-upload-behavior)
9+
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/mongosoft/yii2-upload-behavior.svg?style=flat-square)](https://scrutinizer-ci.com/g/mongosoft/yii2-upload-behavior/code-structure)
10+
[![Quality Score](https://img.shields.io/scrutinizer/g/mongosoft/yii2-upload-behavior.svg?style=flat-square)](https://scrutinizer-ci.com/g/mongosoft/yii2-upload-behavior)
11+
[![Total Downloads](https://img.shields.io/packagist/dt/mongosoft/yii2-upload-behavior.svg?style=flat-square)](https://packagist.org/packages/mongosoft/yii2-upload-behavior)
812

913
Installation
1014
------------
@@ -61,8 +65,8 @@ class Document extends ActiveRecord
6165
'class' => UploadBehavior::className(),
6266
'attribute' => 'file',
6367
'scenarios' => ['insert', 'update'],
64-
'path' => '@webroot/upload/docs/{category.id}/',
65-
'url' => '@web/upload/docs/{category.id}/',
68+
'path' => '@webroot/upload/docs/{category.id}',
69+
'url' => '@web/upload/docs/{category.id}',
6670
],
6771
];
6872
}
@@ -103,7 +107,7 @@ class User extends ActiveRecord
103107
public function behaviors()
104108
{
105109
return [
106-
'image' => [
110+
[
107111
'class' => UploadImageBehavior::className(),
108112
'attribute' => 'image',
109113
'scenarios' => ['insert', 'update'],
@@ -175,16 +179,15 @@ class Track extends ActiveRecord
175179
{
176180
return [
177181
[
178-
'class' => UploadBehavior::className(),
182+
'class' => UploadBehavior::className(),
179183
'attribute' => 'image',
180-
'scenarios' => [ 'default' ],
181-
'path' => '@webroot/uploads/{artist.slug}/',
182-
'url' => '@web/uploads/{artist.slug}/',
184+
'scenarios' => ['default'],
185+
'path' => '@webroot/uploads/{artist.slug}',
186+
'url' => '@web/uploads/{artist.slug}',
183187
],
184188
];
185189
}
186190
}
187191
```
188192

189193
If related model attribute `slug` will change, you must change folders' names too, otherwise behavior will works not correctly.
190-

0 commit comments

Comments
 (0)