It could be something like this, so you have to join two tables
$products = Product::select('products.*')
->leftJoin('product_discounts', 'products.id', '=', 'product_discounts.product_id')
->orderByRaw('IFNULL(product_discounts.price, products.price) ASC')
->get();
Also you can add eager loading if you want
$products = Product::select('products.*')->with('discount')
->leftJoin('product_discounts', 'products.id', '=', 'product_discounts.product_id')
->orderByRaw('IFNULL(product_discounts.price, products.price) ASC')
->get();
Use your column name for price and also relationship name.