jeudi 1 septembre 2016

Octobercms display count in columns.yaml

How to display the count relationship in column.yaml? Please check my 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 is correct but i only need the count value to display in the column fields. Any help is greatly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire