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 Answers 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

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.