get value by their key in collection laravel 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');