Laravel Array output [0] => 1 [1] => 2 [2] => 3 [3] => 4 -
i displayed data database using following code
$mani = db::select('select id employee'); output :
array ( [0] => stdclass object ( [id] => 1 ) [1] => stdclass object ( [id] => 2 ) [2] => stdclass object ( [id] => 3 ) [3] => stdclass object ( [id] => 4 ) ) i need following exact output :
array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) please share solution. thank you
change code use pluck() instead, change
$mani = db::select('select id employee'); to
$mani = db::table('employee')->pluck('id');
Comments
Post a Comment