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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -