php - Octobercms display count in columns.yaml -


how display count relationship in column.yaml? please check code.

user.php model

public $hasmany = [     'views' => ['acme\analytics\models\view'],     'views_count' => ['acme\analytics\models\view', 'count' => true] ]; 

columns.yaml

# =================================== #  list column definitions # ===================================  columns:     views_count:         label: views 

display or return value

[{"user_id":1,"count":3}]  

the return value correct need count value display in column fields. appreciated.

try

# =================================== #  list column definitions # ===================================  columns:     views_count:         label: views         select: count 

Comments