The class of the ActiveRecord should be specified via [[modelClass]], which must implement ActiveRecordInterface.
By default, the following actions are supported:
- index: list of models
- view: the details of a model
- create: create a new model
- update: update an existing model
- delete: delete an existing model
You may disable some of these actions by overriding CrudController::actions and unsetting the corresponding actions.
/** * @inheritdoc */ public function actions() { $actions = parent::actions(); unset($actions['create']); unset($actions['update']); return $actions; }
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['delete' => ['class' => 'yii2tech\\admin\\actions\\SafeDelete'], 'restore' => ['class' => 'yii2tech\\admin\\actions\\Restore'], 'suspend' => ['class' => 'yii2tech\\admin\\actions\\Callback', 'callback' => 'suspend'], 'activate' => ['class' => 'yii2tech\\admin\\actions\\Callback', 'callback' => 'activate']]); }
/** * @inheritdoc */ public function actions() { $actions = parent::actions(); unset($actions['create']); return ArrayHelper::merge($actions, ['suspend' => ['class' => 'yii2tech\\admin\\actions\\Callback', 'callback' => 'suspend'], 'activate' => ['class' => 'yii2tech\\admin\\actions\\Callback', 'callback' => 'activate']]); }