0
  0 => array:9 [
    "id_penandatangan_sertifikat" => 1
    "id_penandatangan" => 1
    "id_sertifikat" => 1
    "id_status" => 1
    "tenggang_waktu" => "2020-01-12"
    "created_at" => "2020-04-17 13:29:37"
    "updated_at" => "2020-04-17 13:29:37"
    "sertifikat" => array:10 [
      "id_sertifikat" => 1
      "id_event" => 1
      "id_status" => 3
      "nama_sertifikat" => "Secret"
      "description" => "Ditandatangani oleh Mulyono"
      "sertifikat" => "UGMTalks.rtf"
      "created_at" => "2020-04-17 13:29:37"
      "updated_at" => "2020-04-17 13:29:37"
      "sertif_URL" => "http://localhost:8000/Secret.rtf"
      "event" => array:12 [
        "id_event" => 1
        "id_detail_event" => 1
        "id_panitia" => 1
        "id_kategori" => 3
        "id_status_biaya" => 9
        "id_status_event" => 5
        "nama_event" => "Secret"
        "organisasi" => "Universitas"
        "created_at" => "2020-04-17 13:29:37"
        "updated_at" => "2020-04-17 13:29:37"
      ]
    ]
    "penandatangan" => array:12 [
      "id_penandatangan" => 1
      "id_users" => 8
      "nama_penandatangan" => "Mulyono"
      "instansi" => "Universitas"
      "jabatan" => "Rektor"
      "nip" => 9109109019091
      "file_p12" => "mulyono.p12"
      "profile_picture" => "mulyono.jpg"
      "created_at" => "2020-04-17 13:29:36"
      "updated_at" => "2020-04-17 13:29:36"
      "deleted_at" => null
      "image_URL" => "http://localhost:8000/uploads/penandatangan/Panut.jpg"
    ]
  ]
]

How do I output the value of sertifikat, nama_event, and nama_penandatangan?

i try array_values[0]['sertifikat'], array_values[0]['nama_event'], array_values[0]['nama_penandatangan'] but doesn't work

2 Answers2

0

You need to convert the object to an actual array. This question has been asked before, you can find an answer here: Convert laravel object to array

mladoux
  • 11
  • 2
0

You can get the names using a single foreach() or by using the array index like below,

echo $response['sertifikat']['nama_sertifikat'].PHP_EOL;
echo $response['sertifikat']['event']['nama_event'].PHP_EOL;
echo $response['penandatangan']['nama_penandatangan'].PHP_EOL;

DEMO: https://3v4l.org/TfMY2

A l w a y s S u n n y
  • 36,497
  • 8
  • 60
  • 103