Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 2 years ago.
0

Comment out the objects that you are trying to access e.g. {{ $variable->name }}, with blade comments {{-- --}} and run through them all including nested views and you will find the culprit :).

Or

dd() all the input sent to the view and find some null data.

Last updated 2 years ago.
0

Ok thanks i'll try those two!

Last updated 2 years ago.
0

matthewburrow said:

Comment out the objects that you are trying to access e.g. {{ $variable->name }}, with blade comments {{-- --}} and run through them all including nested views and you will find the culprit :).

Or

dd() all the input sent to the view and find some null data.

The diedump didn't give me anything unusual, and commenting the objects out didn't change anything. (also tried in the nested views) :(

Last updated 2 years ago.
0

Well something within the input will be NULL either not them or a property on objects within the input such as models etc.

Last updated 2 years ago.
0

This sounds like your object does not exist OR that it is an array...

This adding an "@" infront of the: $yourVar->value; to: @$yourVar->value;

OR

try this:

Change this: {{ $yourVar->value }} To: {{ $yourVar['value'] }}

Hard to tell without seeing any code...

Last updated 2 years ago.
0

Fixed it, after a loooonnnggg search the bug was in the database. Luckely i had a backup :)

Still odd that laravel gave me a complete different error.

Last updated 2 years ago.
0

lorienhd said:

Fixed it, after a loooonnnggg search the bug was in the database. Luckely i had a backup :)

Still odd that laravel gave me a complete different error.

It gave you the correct error, its just the data that you were trying to access was not there. I.e. from a relationship, if the relationship data does not exist, the attributes on that data would neither exists, leading to 'Trying to get property of non-object.'.

Last updated 2 years ago.
0

Well that solved my problem. Thanks for the suggestions. I am surprised why an array is returned although I did not use toArray() or anything, used just pure \App\Organization::paginate(15).

Thanks.

makzumi said:

This sounds like your object does not exist OR that it is an array...

This adding an "@" infront of the: $yourVar->value; to: @$yourVar->value;

OR

try this:

Change this: {{ $yourVar->value }} To: {{ $yourVar['value'] }}

Hard to tell without seeing any code...

0

makzumi said:

This sounds like your object does not exist OR that it is an array...

This adding an "@" infront of the: $yourVar->value; to: @$yourVar->value;

OR

try this:

Change this: {{ $yourVar->value }} To: {{ $yourVar['value'] }}

Hard to tell without seeing any code...

I had same error and this solution helps me to pass it. thanks in advanced!

0

makzumi said:

This sounds like your object does not exist OR that it is an array...

This adding an "@" infront of the: $yourVar->value; to: @$yourVar->value;

OR

try this:

Change this: {{ $yourVar->value }} To: {{ $yourVar['value'] }}

Hard to tell without seeing any code...

Thanks for the solution. It help me to. May i know where to read more on this? Thanks!

0

makzumi said:

This sounds like your object does not exist OR that it is an array...

This adding an "@" infront of the: $yourVar->value; to: @$yourVar->value;

OR

try this:

Change this: {{ $yourVar->value }} To: {{ $yourVar['value'] }}

Hard to tell without seeing any code...

Solved, Thanks :D

0

Hello, i have something like this

<p>Posted In:{{ $post->category->name }}</p>

and the error is " Trying to get property of non-object " and i have also populated the database correctly :(

can you please suggest me a solution, thank you

(i have tried with @$post.. but it doesn't display any value)

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lorienhd lorienhd Joined 20 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.