jeudi 5 septembre 2019

Convert array of objects to array of values in Laravel

I have below code in my laravel application controller:

$levels =  $request->level;
return $levels;

and it returns like this:

{
  1: [
    "9226"
  ],
  2: [
    "166"
  ]
}

which I need is return just values (9226,166) as array like below:

{
  "9226",
  "166"
}

How to get just values?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire