From bcefe73c9cdbe2390d8d1163ec6719d96fc24a17 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 29 Jun 2023 16:52:09 +0100 Subject: [PATCH] Use proper alias for table scope Signed-off-by: snipe --- app/Models/Asset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index c716b77d1e..e3d17d5e35 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -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); }