this is collection i get:
1 => App\Match_fact {#1332 ▼
#guarded: array:2 [▶]
#connection: "mysql"
#table: "match_facts"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:1 [▼
"goals" => 3
]
#original: array:1 [▶]
#changes: []
#casts: []
#classCastCache: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: array:1 [▶]
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []
}
]
}
i tried one option -> count($playerFacts->goals));
but it doesn't worked to me. I get error:
Property [goals] does not exist on this collection instance.
how to count all values got from the collection?