I want to fetch only two columns data from table 1st column data as array key and another column data as array value.
as array['wid'=>'temp']
result should be array['1'=>'1.5','2'=>'11.50']
for laravel 5.4
I want to fetch only two columns data from table 1st column data as array key and another column data as array value.
as array['wid'=>'temp']
result should be array['1'=>'1.5','2'=>'11.50']
for laravel 5.4
You could use the pluck() method (scroll down to the Retrieving A List Of Column Values) e.g.
$data = DB::table('city_list')->pluck('city_name', 'cid');
Use Collection pluck() The pluck method retrieves all of the values for a given key:
$data = DB::table('city_list')->pluck('city_name','cid');
For more information visit laravel doc here