Set table alias for model number sort scope

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-06-26 08:27:17 +01:00
parent 8c6bde335e
commit 4f7b2836b5

View file

@ -1566,7 +1566,7 @@ class Asset extends Depreciable
*/ */
public function scopeOrderModelNumber($query, $order) 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);
} }