laravel array_multisort code example
Example 1: laravel updateOrCreate
$flight = App\Flight::updateOrCreate(
['departure' => 'Oakland', 'destination' => 'San Diego'],
['price' => 99, 'discounted' => 1]
);
Example 2: php sort multidimensional array
$inventory = array(
array("type"=>"Fruit", "price"=>3.50),
array("type"=>"milk", "price"=>2.90),
array("type"=>"Pork", "price"=>5.43),
);
$prices = array_column($inventory, 'price');
$inventory_prices = array_multisort($prices, SORT_DESC, $inventory);
$types = array_map(strtolower, array_column($inventory, 'type'));
$inventory_types = array_multisort($types, SORT_ASC, $inventory);
Example 3: laravel sintax
Hello, {{ $name }}.