getTableQuery
Can we return array inside getTableQuery instead of model, because Iam getting data by combining three database Tables
protected function getTableQuery(): Builder
{
return Arr::get($this->final_result, 'result');
}
3 Replies
I don't think you can return an array. But I have done something similar using custom select statements and union
Example:
SQL union rules apply - so each select statement needs the same number of columns. And you will need to make sure that the columns from each select statement have similar data types
The downside with this is that the model/record is whatever you have returned from the select statement, not a true instance of the model
Thank you
You can return an array using a package called "calebporzio/sushi"