How can convert the result from eloquent to associative array. I need to select tow column and have one as key and another as value. Here is the closet I got, however the value is an array. I want it to be only "my_value" column.
$array = Post::select('my_key','my_value')->get()->keyBy('my_key')
array:2 [▼ "key1" => "value1" "key2" => "value2" ]array:2 [▼ "key1" => array:2 [▼ "my_key" => "key1" "my_value" => "value1" ] "key2" => array:2 [▼ "my_key" => "key2" "my_value" => "value2" ] ]