Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Daniel-Pablo's avatar

how to get a record?

I use this code and get this

return $info = $curso->sections->first();

{
	"id": 1,
	"course_id": 1,
	"sort_order": 1,
	"tittle": "introduccion",
	"information": [
		{
		"tittle": "soy el titulo del video 1",
		"video": "432423"
		}
	],
	"created_at": "2020-07-09T01:53:48.000000Z",
	"updated_at": "2020-07-09T01:53:48.000000Z"
}

How to get information -> Tittle? thanks in advance

0 likes
4 replies
Daniel-Pablo's avatar

come on @jlrdw men how can I get out this info with my own code...? // sorry for my response , its been like 8 hours trying to get it , and reading a lot on forums a no way getting a start, but after read all you post all makes sense

jlrdw's avatar

I'm just on phone now not computer. But I will explain the way I do it

After you Json decode, dd your data, doing that will show you how to step through that and get what you need.

Did you look at my example that shows exactly how to step through an array and get data.

Generally I don't mind giving examples but I don't like rewriting code. So if the example doesn't help just totally ignore this and wait on another reply. But what you are after it's very simple to do.

Like the part

   echo $decoded["superior"][1][1]["role"];

It all boils down to levels.

Daniel-Pablo's avatar

woooooooowwwwwwwwwwww mennnnnnnn you did it!! @jlrdw thank you very much for taking some time on this!!, really appreciate it!!

I read all the post you reply to me and get the idea , and end with this

        $info = $curso->sections->first();

        $decoded = json_decode($info, true);

        dd($decoded["information"][0]["tittle"]);

thanks, that make the trick

Please or to participate in this conversation.