laravel to array with key as id code example
Example 1: laravel eloquent to array key value
Icon::all()->keyBy('name')
Example 2: laravel eloquent to array key value
$roles = collect(DB::table('roles')->get())->keyBy('name');
Icon::all()->keyBy('name')
$roles = collect(DB::table('roles')->get())->keyBy('name');