area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.63k stars 560 forks source link

Don't load relation for each column and allow dot notation in field name for index table #2603

Closed Tofandel closed 1 month ago

Tofandel commented 1 month ago

We can eager load attributes using eagerLoadListingRelations([]) in the setUp of the controller, however the Relation column doesn't actually use the loaded relation (and doesn't work with one to one relation) it currently runs a query for each column and each model and the default Text also cannot use it because it does not use dot notation traversal

This PR aims to greatly improve this by only loading the relation once and allowing dot notation in text column to allow to retrieve fields in one to one relations or json