From c7106a1df285a10808fd8107300dc5f77cd90b27 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 27 Feb 2023 13:24:09 -0800 Subject: [PATCH] Added table aliases to fix ambiguous SQL clause Signed-off-by: snipe --- app/Models/Asset.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 725d1eee81..37e932cfa1 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -1641,9 +1641,9 @@ class Asset extends Depreciable */ public function scopeOrderManufacturer($query, $order) { - return $query->join('models', 'assets.model_id', '=', 'models.id') - ->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id') - ->orderBy('manufacturers.name', $order); + return $query->join('models as order_asset_model', 'assets.model_id', '=', 'order_asset_model.id') + ->join('manufacturers as manufacturer_order', 'order_asset_model.manufacturer_id', '=', 'manufacturer_order.id') + ->orderBy('manufacturer_order.name', $order); } /**