Commit 61e93916 by dianc

Category Updated

parent 44ccbb66
......@@ -25,15 +25,6 @@ class CategoryController extends Controller
'delete' => ['post'],
],
],
[
'class' => SluggableBehavior::className(),
'attribute' => 'name',
],
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at'
]
];
}
......
......@@ -33,7 +33,7 @@ use yii\bootstrap\ActiveForm;
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'image_url')->widget(
<?= $form->field($model, 'image')->widget(
\trntv\filekit\widget\Upload::className(),
[
'url' => ['/file-storage/upload'],
......
......@@ -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
*/
......
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