key with array column place chnage in laravel code example
Example 1: laravel eloquent to array key value
$roles = collect(DB::table('roles')->get())->keyBy('name');
Example 2: laravel eloquent to array key value
$roles = Role::all()->keyBy('name');