Using dot to load related data

I have a table with two foreign keys that are from the same table, how do I make that work
->columns([
TextColumn::make('employees.name')
->label('Issued By'),
TextColumn::make('employees.name')
->label('Issued To'),
])
->columns([
TextColumn::make('employees.name')
->label('Issued By'),
TextColumn::make('employees.name')
->label('Issued To'),
])
this just makes one column disappear can anyone help?
Solution:
TextColumn::make('relationship1.name');
TextColumn::make('relationship2.name');
TextColumn::make('relationship1.name');
TextColumn::make('relationship2.name');
...
Jump to solution
4 Replies
Solution
Arko
Arko14mo ago
TextColumn::make('relationship1.name');
TextColumn::make('relationship2.name');
TextColumn::make('relationship1.name');
TextColumn::make('relationship2.name');
The Huntsman
The HuntsmanOP14mo ago
you mean make another relationship for relationship2 in the model file right?
Arko
Arko14mo ago
Correct, yeah. You need some way to distinct the two relationships And the dot syntax is <relationship>.<attribute>
The Huntsman
The HuntsmanOP14mo ago
Yup that worked, thanks, I thought it was <table>.<attribute> my bad
Want results from more Discord servers?
Add your server