Skip to content
Advertisement

Why do I get Trying to get property ‘username’ of non-object while “owner_user” has information in it?

HTML Code

JavaScript

Laravel code

JavaScript

when I just return Posts table, it has column owner_user with user information in it. relations work, but somehow I get “Null” as a result in {{ $post->owner_user->username }} when I return it in HTML code.

Advertisement

Answer

because that is not a single object try

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement