Trying to get property 'guid' of non-object.
- Dominant language
- PHP
- Stars
- 4.8k
- Forks
- 600
- PR merge metrics
- No merged PRs in 30d
Description
- 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

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.