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

@ -303,6 +303,11 @@ class BatteryManufacturerController extends BaseController
} }
} }
// order by price
usort($batteries, function ($a, $b) {
return -($a['sell_price'] <=> $b['sell_price']);
});
// response // response
return $this->json([ return $this->json([
'data' => $batteries 'data' => $batteries