Merge pull request #13200 from snipe/bug/sc-23417

Set table alias for model number sort scope
This commit is contained in:
snipe 2023-06-26 08:29:16 +01:00 committed by GitHub
commit 49b50d81ee
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->join('models', 'assets.model_id', '=', 'models.id')->orderBy('models.model_number', $order);
return $query->leftJoin('models as model_number_sort', 'assets.model_id', '=', 'models.id')->orderBy('models.model_number', $order);
}