Commit 61e93916 by dianc

Category Updated

parent 44ccbb66
...@@ -25,15 +25,6 @@ class CategoryController extends Controller ...@@ -25,15 +25,6 @@ class CategoryController extends Controller
'delete' => ['post'], 'delete' => ['post'],
], ],
], ],
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
]; ];
} }
......
...@@ -33,7 +33,7 @@ use yii\bootstrap\ActiveForm; ...@@ -33,7 +33,7 @@ use yii\bootstrap\ActiveForm;
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<?= $form->field($model, 'image_url')->widget( <?= $form->field($model, 'image')->widget(
\trntv\filekit\widget\Upload::className(), \trntv\filekit\widget\Upload::className(),
[ [
'url' => ['/file-storage/upload'], 'url' => ['/file-storage/upload'],
......
...@@ -66,6 +66,27 @@ class Category extends \yii\db\ActiveRecord ...@@ -66,6 +66,27 @@ class Category extends \yii\db\ActiveRecord
]; ];
} }
public function behaviors()
{
return [
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
],
[
'class' => UploadBehavior::className(),
'attribute' => 'image',
'pathAttribute' => 'image_path',
'baseUrlAttribute' => 'image_url',
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
/** /**
* @return \yii\db\ActiveQuery * @return \yii\db\ActiveQuery
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment