I have the following query:
$items = UserItems::with('item') ->where('user_id','=',$this->id) ->where('quantity','>',0) ->get();
I need to order it by item.type, so I tried:
$items = UserItems::with('item') ->where('user_id','=',$this->id) ->where('quantity','>',0) ->orderBy('item.type') ->get();
but I get an Unknown column 'item.type' in 'order clause'
What am I missing?
source share