Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to get property 'guid' of non-object. #608

Open
TheRealSageKing opened this issue Mar 9, 2022 · 0 comments
Open

Trying to get property 'guid' of non-object. #608

TheRealSageKing opened this issue Mar 9, 2022 · 0 comments

Comments

@TheRealSageKing
Copy link

TheRealSageKing commented Mar 9, 2022

  • Corcel Version: 5.1.1
  • Framework Name & Version: Laravel 9.0
  • PHP Version: 7.4
  • Database Driver & Version: MYSQL 8.0

Description:

I get the above error when i try to get featured image of a post with bad featured image.

Steps To Reproduce:

  • Install FakerPress (to generate random posts with featured images)

  • from laravel make a request to fetch all posts and display feature images

  • I used this method in my model to retrieve thumbnails

public function getPostThumbnail()
    {
        try{
            if ( !is_null($this->meta->_thumbnail_id) )
            {
                return $this->thumbnail;
            }
            return asset('images/blog/1.jpg');
        }catch(\Exception $ex)
        {
            return asset('images/blog/1.jpg');
        }
    }

so i can call it like so $post->getPostThumbnail().

I got the error as shown in the screenshot below
Screenshot 2022-03-09 at 02 44 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant