内容简介:一个游戏有多个开发商和发行商,一个开发商也有多个游戏。他们是多对多的关系5312
<?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], // 'id', // 'game_name', [ 'label' => 'logo_img', 'value' => function($model){ return '<img src="' . $model->logo_img . '" style="width:200px;"></img>'; }, 'format' => 'raw', ], [ 'label' => '游戏名称', 'value' => function($model){ return Html::a($model->game_name, ['steamtopgame/view', 'id' => $model->id]); }, 'format' => 'raw', ], 'current_user_count', 'high_user_count', // 'scrapy_date', [ 'label' => '开发商', 'value' => function($model){ $result = ''; for($i = 0; $i < count($model->steamGameDevs); $i++){ // $result = $result . $model->steamGameDevs[$i]->dev->dev_name; $result = $result . Html::a($model->steamGameDevs[$i]->dev->dev_name, ['steamdevdetail/view', 'id' => $model->steamGameDevs[$i]->dev->id]); if($i != count($model->steamGameDevs) - 1){ $result = $result . '<br/>'; } } return $result; }, 'format' => 'raw', ], [ 'label' => '发行商', 'value' => function($model){ $result = ''; for($i = 0; $i < count($model->steamGameSells); $i++){ // $result = $result . $model->steamGameSells[$i]->sell->sell_name; $result = $result . Html::a($model->steamGameSells[$i]->sell->sell_name, ['steamselldetail/view', 'id' => $model->steamGameSells[$i]->sell->id]); if($i != count($model->steamGameSells) - 1){ $result = $result . '<br/>'; } } return $result; // return join(', ', yii\helpers\ArrayHelper::map($model->steamGameSells, 'sell_id', 'sell_id')); }, 'format' => 'raw', ], [ 'label' => '最高在线人数占比', 'value' => 'totalPercent' ] // ['class' => 'yii\grid\ActionColumn'], ], ]); ?>
一个游戏有多个开发商和发行商,一个开发商也有多个游戏。他们是多对多的关系
5312
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。