I need use collect in Laravel 5.3 but I need help.
For Example:
$collection = collect([
'Apple' => [
['name' => 'iPhone 6S', 'price' => '200'],
['name' => 'iPhone 7S', 'price' => '250'],
],
'Samsung' => [
['name' => 'Galaxy S7', 'price' => '300']
['name' => 'Galaxy note', 'price' => '150']
],
]);
- How to get
Apple
orSamsung
name with collect? I need get brand name. - How to get (name and price) the cheapest price of each brand.
Thank you :-)