[ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => [ 'POST' ], ], ], 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => [ '@' ], ], ], ], ]; } public function actions() { return [ 'index' => [ 'class' => Index::className(), 'columns' => [ 'id' => [ 'type' => Index::NUMBER_COL, ], 'link' => [ 'type' => Index::ACTION_COL, ], 'sort' => [ 'type' => Index::POSITION_COL, ], 'status' => [ 'type' => Index::STATUS_COL, ], ], 'model' => Partner::className(), 'hasLanguage' => false, 'enableMassDelete' => true, 'modelPrimaryKey' => 'id', 'defaultSort' => [ 'id' => SORT_DESC ] ], 'create' => array_merge([ 'class' => Create::className() ], self::fieldsConfig()), 'update' => array_merge([ 'class' => Update::className() ], self::fieldsConfig()), 'view' => [ 'class' => View::className(), 'model' => Partner::className(), 'hasAlias' => false, 'fields' => [ [ 'name' => 'image_id', 'type' => Form::IMAGE, ], [ 'name' => 'link', 'type' => Form::STRING, ], ], ], 'delete' => [ 'class' => Delete::className(), ], ]; } public function findModel($id) { $model = Partner::find() ->where([ 'id' => $id ]) ->one(); if ($model !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } public function newModel() { return new Partner(); } public function deleteModel($id) { $page = Partner::find() ->where( [ 'id' => $id, ] ) ->one(); return $page->delete(); } protected static function fieldsConfig() { return [ 'model' => Partner::className(), 'hasAlias' => false, 'fields' => [ [ 'name' => 'image_id', 'type' => Form::IMAGE, ], [ 'name' => 'link', 'type' => Form::STRING, ], [ 'name' => 'status', 'type' => Form::BOOL, ], [ 'name' => 'sort', 'type' => Form::NUMBER, ], ], ]; } }