Convert Eloquent relationship to query builder for table?

Is it possible to use Eloquent relationships in the getTableQuery() method of the table builder? I want to do this because I have all of the relationships I want to use built as relationships, so rewriting them as queries seems like duplication.

I also realise that I could use query scopes - but this also feels like duplication, as I wouldn't need the scopes anywhere else.

I understand the table builder needs a query builder though - so I wondered if there was a way to convert something like a HasMany to an Eloquent query builder so I can use it in this way.
Was this page helpful?