Merge pull request #13228 from snipe/bug/sc-23434

Use proper alias for table scope
This commit is contained in:
snipe 2023-06-29 17:11:50 +01:00 committed by GitHub
commit 825e988dfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);
}