toRawSql(); return $this->userGroup->currencyExchangeRates() ->where(function (Builder $q1) use ($from, $to): void { $q1->where(function (Builder $q) use ($from, $to): void { $q->where('from_currency_id', $from->id) ->where('to_currency_id', $to->id) ; })->orWhere(function (Builder $q) use ($from, $to): void { $q->where('from_currency_id', $to->id) ->where('to_currency_id', $from->id) ; }); }) ->orderBy('date', 'DESC')->get(['currency_exchange_rates.*']) ; } }