laravel collection keys

Solutions on MaxInterview for laravel collection keys by the best coders in the world

showing results for - "laravel collection keys"
Maya
10 Aug 2020
1$collection = collect([
2    'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],
3    'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],
4]);
5
6$keys = $collection->keys();
7
8$keys->all();
9
10// ['prod-100', 'prod-200']
Viktoria
15 Apr 2018
1$users->modelKeys();
2
3// [1, 2, 3, 4, 5]