Passing a custom DB::query() to ListResource.php

Hey Everyone, I have a very complex SQL Query which gets me the data I want. I want it to be shown in the resource list page. Now, Inside the ListResource.php file, I am trying to amend the getTableQuery() function, but the return type required is \Illuminate\Database\Eloquent\Builder and I want to return a custom query which is of type \Illuminate\Database\Query\Builder. Is there any way to achieve this?
2 Replies
Dan Harrin
Dan Harrin2y ago
you have to use an Eloquent builder and add your custom SQL in there instead of using the raw query builder the query needs to start with a model
K R A T O S
K R A T O SOP2y ago
Yeah. That's exactly what I am trying right now. Thanks!
Want results from more Discord servers?
Add your server