Tuesday, April 10, 2018

Yii2 Detail View

DetailView is used to display the data by model. You can also use array instead of model.

You can also set $attribues property which columns you want to display using the detailView.

Detail View in Yii2

echo DetailView::widget([
    'model' => $userModel,
    'attributes' => [
        [
            'attribute' => 'user',
            'value' => function ($data) {
                return $data->user->name;
            }
        ],
    ],
]);

1 comment:

  1. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    PHP Coders in India

    ReplyDelete

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search