dimanche 21 juin 2020

how to change array structure from laravel collection?

im newb using laravel and hope someone helps me.

i have data details from database and get it with laravel collection ,here my code :

 public function index()
  {
    $corpus = V_Corpus::select('details')->pluck('details');

    dd($corpus);
  }

and the result var_dump is an array with structure like this:

Illuminate\Support\Collection {#205 ▼
  #items: array:3 [▼
   0 => "CPU Socket LGA1151 Chipset Intel Z390  4 x DIMM Max 64GB DDR4"
   1 => "CPU Socket LGA1151 Chipset Intel Z390  4 x DIMM Max 64GB DDR4"
   2 => "CPU Socket LGA1151 Chipset Intel Z390  4 x DIMM Max 64GB DDR4"
  ]
}

the problem is how can u change the array srtructure from the previous array to look like this :

array:3 [▼
   0 => "CPU Socket LGA1151 Chipset Intel Z390  4 x DIMM Max 64GB DDR4"
   1 => "CPU Socket LGA1151 Chipset Intel Z390  4 x DIMM Max 64GB DDR4"
   2 => "CPU Socket LGA1151 Chipset Intel Z390  4 x DIMM Max 64GB DDR4"
]

sorry for my bad english.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3dosSeS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire