jeudi 21 juillet 2016

Laravel Reproduce an array given by the eloquent model

I am new in laravel. Right now i am struggling on how to redeclare the array given by the eloquent model.

PHP code

$data = Commission::select(['uploads_id'])->where([
            'affiliate_code' => $id
        ])->get()->toArray();
        var_dump($data);

var_dump Output

array(3) {
  [0]=>
  array(1) {
    ["uploads_id"]=>
    string(2) "24"
  }
  [1]=>
  array(1) {
    ["uploads_id"]=>
    string(2) "26"
  }
  [2]=>
  array(1) {
    ["uploads_id"]=>
    string(2) "27"
  }
}

i want the $data to be redeclare like this.

$data = [24 , 25 , 26]

is there a way on it or different approach?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire