Answers for "laravel collection keys"

PHP
0

laravel collection keys

$collection = collect([
    'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],
    'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],
]);

$keys = $collection->keys();

$keys->all();

// ['prod-100', 'prod-200']
Posted by: Guest on July-24-2021
0

laravel collection modelKeys

$users->modelKeys();

// [1, 2, 3, 4, 5]
Posted by: Guest on July-24-2021

Code answers related to "laravel collection keys"

Browse Popular Code Answers by Language