php - how to use function in DetailView yii2 -


**i use model function in detail view how use function in detail view  **  <?= detailview::widget([     'model' => $model,      'attributes' => [        'title',         'demand',         'sell_for',         'property_category',         'detail',         [          'attribute' => 'dealer_id',          'format'=>'raw',          'value'=> function ($model) {          return dealer::getname($model->dealer_id);                   }     ],    ], ]) ?> 

**i use model function in detail view how use function in detail view **

in detailview value don't need anonymous function assign ..

      [      'attribute' => 'dealer_id',      'format'=>'raw',      'value'=> dealer::getname($model->dealer_id);  ], 

see yii2 doc


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -