'Acessing property from blade view laravel

Im trying to show some data in my view and ONLY the id property is getting changed to some random number when its passed to the view. The other properties are okay.

If I try to access a property from a view like this: {{ dd($var[1]) }}, it works and I can see the id like this:

enter image description here

But if I try to access passing the id directly: {{ dd($var[1]['id']) }} or {{ dd($var[1]->id) }}, I just get this:

enter image description here

And here are some more examples from what I get accessing it directly:

enter image description here

If I use gettype() is this var I get Integer back, but it is actually a string as you can see in the first printscreen.

Why is my blade view doing this? And how can I fix it?



Solution 1:[1]

I ended up using another id I was receiving in the same array, looks like blade was decoding the string or something like that. Thanks for the answers.

Solution 2:[2]

in your controller please select id as new_id and try to print

$var[1]->new_id or $var[1]['new_id']

it will fix your problem if fixed give a green tick and a thumbs up else leave a commetn will try to update you

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sasquatch
Solution 2 Salman ansari