laravel eloquent to array key value
snippet in php

laravel eloquent to array key value

user7299

Icon::all()->keyBy('name')

laravel eloquent to array key value

user8016

$roles = Role::all()->keyBy('name');

laravel eloquent to array key value

user150

$roles = collect(DB::table('roles')->get())->keyBy('name');