Sort compatible battery list by highest price #24

This commit is contained in:
Ramon Gutierrez 2018-02-27 02:46:52 +08:00
parent cae5a5bbac
commit d77dbcd209

View file

@ -300,9 +300,14 @@ class BatteryManufacturerController extends BaseController
'warr_private' => $battery->getWarrantyPrivate(),
'warr_commercial' => $battery->getWarrantyCommercial(),
];
}
}
}
// order by price
usort($batteries, function ($a, $b) {
return -($a['sell_price'] <=> $b['sell_price']);
});
// response
return $this->json([
'data' => $batteries