laravel push in colleciton at first place code example
Example 1: laravel eloquent to array key value
Icon::all()->keyBy('name')
Example 2: laravel eloquent to array key value
$roles = Role::all()->keyBy('name');
Icon::all()->keyBy('name')
$roles = Role::all()->keyBy('name');