Answers for "sort by laravel function"

PHP
2

laravel order by

$users = DB::table('users')
         -> orderBy('name', 'desc')
         -> get();
Posted by: Guest on March-09-2021
0

laravel sort by function'

$go = $go->sort(function ($a, $b) use ($order) {
  $pos_a = array_search($a->colour, $order);
  $pos_b = array_search($b->colour, $order);
  return $pos_a - $pos_b;
});
Posted by: Guest on December-08-2021

Browse Popular Code Answers by Language