write name using id

in there i have company_id and i want using that write company_name how ican do it ?
TextColumn::make('purchase.company_id')
->searchable()
->sortable(),
TextColumn::make('purchase.company_id')
->searchable()
->sortable(),
Solution:
Please don't tag as per #✅┊rules No that doesn't make sense like. I think what you want is to use:...
Jump to solution
4 Replies
toeknee
toeknee3mo ago
How do you mean? an ID isn't a name so how can it write it.
gigiloouu
gigiloouu3mo ago
like in purchase table i have company_id and using that i want to take company_id and in company table take name where id === company_id u got it ? @toeknee ??
Solution
toeknee
toeknee3mo ago
Please don't tag as per #✅┊rules No that doesn't make sense like. I think what you want is to use: purchase.company.name assuming you have a relationship called company on the purchase model. And name on the company model.
gigiloouu
gigiloouu3mo ago
okay sorry and thanks ❤️