'getting null values from the collection
I have an array that comes from an API request that has the stucture below.
^ array:40 [
  "id" => 2
  ...
  "categories" => array:2 [
    "data" => array:15 [
      0 => array:3 [
        "id" => 6
        "name" => array:1 [
          "en" => "General"
        ]
        "on_request" => 0
      ]
      1 => array:3 [
        "id" => 14
        "name" => array:1 [
          "en" => "Tuts"
        ]
        "on_request" => 0
      ]
      2 => array:3 [
        "id" => 3
        "name" => array:1 [
          "en" => "Laravel"
        ]
        "on_request" => 0
      ]
      
      ...
  ]
  ...
 ]
The array has a 'categories' key and I want to get each category here and store it on a json column on the posts table.
I was trying like this:
dd(collect($postInformation)->pluck('categories'));
But it shows
Illuminate\Support\Collection {#1435
  #items: array:40 [
    0 => null
    1 => null
    2 => null
    ...
Do you know how to properly achieve this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
