控制器里没有$model
变量
public function actionIndex()
{
// if (!ctype_digit($parent)) {
// throw new InvalidValueException();
// }
$searchModel = new NsortSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
// 'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
但视图中的$model
是从哪里来的
[
'attribute' => 'parent',
'value' => function ($model) {
return empty($model->parent) ? '-' : $model->parent->name;
},
],
茅侃侃