php - Convert laravel object to js array -
i new in laravel. how convert laravel object js array. coce below..
$customer = new customer(); $result = $customer->where('client_state','like', '%'.$statename.'%')->get(array('client_state')); echo $result;
result is...
[{"client_state":"gujarat1"},{"client_state":"gujarat"}]
but need this..
["gujarat1","gujarat"]
how possible?
if want query return array of values set values of preferred column, use method lists('your_column_here')
instead of get()
try this:
$result = $customer->where('client_state','like', '%'.$statename.'%')->lists('your_column'));
reference here: http://laravel.com/docs/5.0/queries#selects
Comments
Post a Comment