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:
But if I try to access passing the id directly: {{ dd($var[1]['id']) }}
or {{ dd($var[1]->id) }}
, I just get this:
And here are some more examples from what I get accessing it directly:
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?
CodePudding user response:
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
CodePudding user response:
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.