Use proper alias for table scope

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-06-29 16:52:09 +01:00
parent a3096e1b47
commit bcefe73c9c

View file

@ -1566,7 +1566,7 @@ class Asset extends Depreciable
*/
public function scopeOrderModelNumber($query, $order)
{
return $query->leftJoin('models as model_number_sort', 'assets.model_id', '=', 'models.id')->orderBy('models.model_number', $order);
return $query->leftJoin('models as model_number_sort', 'assets.model_id', '=', 'model_number_sort.id')->orderBy('model_number_sort.model_number', $order);
}