Column relationships problem
Hey !
In a relation manager resource, i have this code :
with just "Tables\Columns\TextColumn::make('enseignants')", i have my badges filled with json, like "{"id":15,"civilite_id":2,"prenom":"Audrey","nom" ...." .
Usually i have to add the field, like "Tables\Columns\TextColumn::make('enseignants.prenom')" to display only "prenom" in the badge. but when i add it, i have a "Call to a member function enseignants() on null" error.
The models is :
`
I dont know what to do to make it work :/
6 Replies
looks like one of the record dont have data for
matiere
!Ok, i have delete records, i now have just one "MatiereSession record, when i add a Tables\Columns\TextColumn::make('matiere.nom') i have the name of the "matiere" so there is datas for matiere ?
When i have only "Tables\Columns\TextColumn::make('enseignants')", i have :
when i have "Tables\Columns\TextColumn::make('enseignants.prenom')", i get the error :
I'm on the "matieresSession" relationmanager of the "MatiereResource" where "Matiere" model is :
i got the correct result when i use the following code :
But why i cant use this ?